408669: GYM103260 I Trade

Memory Limit:0 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

I. Tradetime limit per test2 secondsmemory limit per test256 mebibytesinputstandard inputoutputstandard output

It is the last day of your vacation and you decided to buy some memorabilia to remind you about these nice times. There are $$$n$$$ merchants, you liked one item from each one. The price written beside the item from $$$i$$$-th merchant is $$$c_{i}$$$. You have $$$S$$$ money with you, and you are ready to spend them on the souvenirs. You don't have any preference so you just want to buy as many different items as possible. It would be an easy job but this is tourist shops we are talking about. They thrive on gullible tourists.

The $$$i$$$-th merchant has a persuasion parameter $$$p_{i}$$$ and they are different for different merchants. The more souvenirs you already have, the more a merchant is sure about your willingness to spend money on worthless crap. If a merchant sees that you have already bought $$$k$$$ souvenirs, he raises the price on his souvenir to $$$c_{i} + k \cdot p_{i}$$$.

What is the maximal number of souvenirs you can buy?

Input

The first line contains two integers $$$n$$$ and $$$S$$$ ($$$1 \le n \le 10^{5}$$$, $$$0 \le S \le 10^{9}$$$) — the number of merchants and the amount of money you have.

The second line contains $$$n$$$ integers $$$c_{1}, c_{2}, \ldots, c_{n}$$$ ($$$1 \le c_{i} \le 10^{9}$$$) — initial prices of all the souvenirs.

The third line contains $$$n$$$ integers $$$p_{1}, p_{2}, \ldots, p_{n}$$$ ($$$0 \le p_{i} \le 10^{9}$$$) — persuasion parameters of all the merchants. It is guaranteed that they are distinct.

Output

Print one number — how many souvenirs you can buy.

ExamplesInput
2 5
1 1
10 11
Output
1
Input
2 22
10 1
0 10000
Output
2
Input
1 0
1
0
Output
0

加入题单

算法标签: