#P8837. [传智杯 #3 决赛] 商店

[传智杯 #3 决赛] 商店

Description

There are nn students going shopping. The shop has mm items. The ii-th person has wiw_i units of money, and the ii-th item costs cic_i yuan.

Each person can buy at most one item, and each item can be bought at most once. Find the maximum number of people who can buy an item.

Constraints: for all testdata, n,m105n, m \leq 10^5, wi,ci109w_i, c_i \leq 10^9.

Input Format

The input has 33 lines in total.

Line 11 contains two positive integers n,mn, m.

Line 22 contains nn integers w1wnw_1 \ldots w_n, where wiw_i is the amount of money of the ii-th person.

Line 33 contains mm integers c1cmc_1 \ldots c_m, where cic_i is the price of the ii-th item.

Output Format

Output one integer, the maximum number of people who can buy an item.

15 20
4 3 9 10 7 7 5 3 6 1 8 6 6 1 5 
12 4 1 9 8 5 8 6 4 5 18 8 14 9 9 7 20 11 8 19 
10

Hint

Translated by ChatGPT 5