## Recommended Posts

Head John very busy lately. And it does not have time to plan the time of your employees manually. So he asked Jerry programmer to write a program that will calculate how much of a certain type of problems his department will be able to solve in the past month.
John knows that to solve this type of problem he needs n employees, each of which will deal with a specific case and can not replace the other. Each of these employees will be engaged in the same task ai hours. Total monthly employee fulfills bi hours. Besides John have Jerry, which can be given to the problem of maximum k hours. Jerry can do the work of any other employee, one hour is equal to one hour of Jerry any other employee.
John need to understand how the tasks can be performed per month maximum knowing n, k, a1-n, and b1-n

Input data
The first line is followed by two positive integers n and k (1 ≤ n ≤ 50000, 1 ≤ k ≤ 109) - the number of employees and number of hours of programmer Jerry.
In the second line followed by a sequence a1, a2, ..., an (1 ≤ ai ≤ 109), where the i-th number equals the number of hours the i-th employee, required for solving a problem.
The third line should be a sequence of b1, b2, ..., bn (1 ≤ bi ≤ 109), where the i-th number equals the number of hours the i-th employee, who is at John.

Output
Print a single number - the maximum number of tasks that can make the employees of the department with the help of their available hours and programmer Jerry.

Examples:

Input data

3 1
2 1 4
11 3 16

The result of

4

Edited by Rogan
##### Share on other sites

I can't even figure out the problem description, and the machine translation wasn't very helpful. I mean,

```Input data
3 1
2 1 4
11 3 16

The result of
4```
3 employees, 1 something, 2,1,4 hours for the three employees to each solve a problem, 11,3,16 something else, and then somehow the result is 4?
##### Share on other sites

From the Forums Rules

Users will not post their homework questions expecting to get their homework coded for them. If you have a question about part of the assignment that you do not understand, please post asking for an explanation rather than the code.

##### Share on other sites

From the Forums Rules

That's right! I'm glad you've suddenly become familiar with the rules. Now how about giving OP a chance to redeem him/herself?
##### Share on other sites

Suddenly? I have never asked for homework help and I don't violate any of the other rules. What are you trying to say?

Shots fired!

##### Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Restore formatting

Only 75 emoji are allowed.