By Thalyson Nepomuceno, Universidade Estadual do Ceará Brazil
Fracil have a breeding N mice and has M foods to feed them.
Each mouse has a level of hunger.
Each food has a level of support.
When a rat with level of hunger h is fed with food with higher support level than or equal to h, the mouse is satiated and your hunger level is reset to zero.
When a rat with level of hunger h is fed with food with lower support level than h, the new hunger level is h-s.
To feed your rats, Fracil follow a strategy:
Fracil want to know how much mice will be satisfied when they finish the food.
The input consists of several test cases. The first line of each test case contains two integers N (1 ≤ N ≤ 1000) and M (1 ≤ M ≤ 1000),
representing the amount of rats and the amount of food.
The second line of each test case contains N integers representing hunger levels of mice (1 ≤ hi ≤ 1000).
The third line of each test case contains M integers, representing food support levels (1 ≤ si ≤ 1000). The input ends with the final file (EOF).
For each test case, print the amount of satiated mice.
Input Sample | Output Sample |
3 4 |
3 |