Assign Cookies
Given children's greed factors and cookie sizes, maximize the number of content children.
Input format
The first line contains N and M. The second line contains N greed factors. The third line contains M cookie sizes.
Output format
Print the maximum number of children satisfied (a child is satisfied if cookie[i] ≥ greed[i]).
Constraints
- Values fit in a 64-bit signed integer
- Trailing whitespace and a trailing newline are ignored by the judge
Read from stdin, write to stdout. Sample cases below show the exact format.
Sample cases
Example 1
Input
3 3
1 2 3
1 2 3Expected output
3Example 2
Input
3 3
1 2 3
1 1 1Expected output
1