Weed Whacking


Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
C++, Java, Python

It's spring time, and you're getting ready to plant your next batch of crops for an autumn harvest. Before any seeds can be planted though, there are a lot of weeds in the field that must be dealt with. Most farmers would get a barrel of herbicide and spray it onto their field, but you want to keep things organic.

So instead, you purchase the WeedWiper 6900 from Agro-Urban Crop Protection Limited (AUCPL) to take care of the pesky weeds. They were dirt cheap, so you buy one hoping to whack away the weeds in no time.

However, those weed whackers were cheap for a reason: they can only cut up to a certain height, and they can only destroy one weed every second. Ugh! Begrudgingly, you get to work in creating a program to calculate the order you should wack your weeds in, to destroy as many as possible before they get out of control.

Input

The first line consists of integers n (1 \leq n \leq 10^5) and h (0 \leq h \leq 10^5) — the number of weeds and the maximum weed height your weed whacker can whack, respectively.

The next line contains n space-separated integers h_i (0 \leq h_i \leq 10^5), the initial height of the ith weed.

The next line contains n space-separated integers r_i (1 \leq r_i \leq 10^5), the growth rates of the ith weed. The growth rate is how much the weed grows in each second.

Output

Output a single integer, the maximum number of weeds you can whack.

Clarification

  • You start whacking weeds at 0 seconds, where the weeds are at their initial height.
  • You can only whack one weed at a time in each second.
  • Once you whack away the weed, it will not regrow.

Example

Input 1
5 50
10 20 30 40 50
2 2 4 10 1
Output 1
5

You can whack all of the weeds before they get too high to whack.

Input 2
4 10
7 7 7 7
1 2 3 4
Output 2
3
  • In the first second, destroy the last weed. The remaining weeds have heights of 8 9 10.
  • In the second second, destroy the third weed. The remaining weeds have heights of 9 11.
  • In the third second, destroy the first weed. The remaining weeds have heights of 13.

The second weed is taller than 10 units, so it can't be destroyed anymore. It can be shown that 3 is the maximum number of weeds you can destroy.


Comments

There are no comments at the moment.