eolymp
bolt
Try our new interface for solving problems
Problems

Saucepans and lids

Saucepans and lids

A huge disaster occurred this morning at the café where you used to have snacks during your university studies. The cleaner, Larisa Ivanovna, accidentally knocked over one of the cabinets while sweeping the floor, causing all the kitchen utensils stored inside to scatter across the floor. Fortunately, it only contained saucepans with lids. However, some of them got bent or broken, so they had to be thrown away. Now the schoolmaster wants to calculate the losses and determine how many new saucepans and lids should be purchased. But first, it is necessary to find out how many remaining saucepans can be covered by the remaining lids. The saucepans and lids are round. A lid can cover a saucepans only if its radius is not less than the radius of the pot. \InputFile The first line contains integers $n, m~(1 \le n, m \le 1000)$ --- the number of remaining saucepans and lids. The second line contains $n$ integers $a_i~(1 \le a_i \le 1000)$ --- the radii of the remaining saucepans. The third line contains $m$ integers $b_i~(1 \le b_i \le 1000)$ --- the radii of the remaining lids. \OutputFile Print one number --- the largest number of saucepans that can be covered by the available lids.
Time limit 1 second
Memory limit 128 MiB
Input example #1
5 5
4 8 1 2 5
7 2 4 6 5
Output example #1
4
Source 2014 ACM-ICPC Ukraine, 2nd Round Ukraine, September 13, Problem L