Code forces-387B-George and Round
Description
George decided to prepare a Codesecrof round, so he has prepared m problems for the round. let's number the problems with integers 1 through m. george estimates the I-th problem's complexity by integer bi.
To make the round good, he needs to put at least n problems there. besides, he needs to have at least one problem with complexity exactly a1, at least one with complexity exactly a2 ,..., and at least one with complexity exactly. of course, the round can also have problems with other complexities.
George has a poor imagination. it's easier for him to make some already prepared problem simpler than to come up with a new one and prepare it. george is magnificent at simplifying problems. he can simplify any already prepared problem with complexity c to any positive integer complexity d (c? ≥? D), by changing limits on the input data.
However, nothing is so simple. george understood that even if he simplifies some problems, he can run out of problems for a good round. that's why he decided to find out the minimum number of problems he needs to come up with in addition to the m he's prepared in order to make a good round. note that George can come up with a new problem of any complexity.
Input
The first line contains two integers n and m (1? ≤? N ,? M? ≤? (3000)-the minimal number of problems in a good round and the number of problems George's prepared. The second line contains space-separated integers a1 ,? A2 ,?...,? An (1? ≤? A1?
Output
Print a single integer-the answer to the problem.
Sample Input
3 5
1 2 3
1 2 2 3 3
3 5
1 2 3
1 1 1 1
3 1
2 3 4
1
Sample Output
0
2
3
George wants to make n game propositions, and the complexity of each question is given. He has prepared m questions, and the complexity is also given. If the complexity of a proposition is not lower than the required complexity, the question is considered qualified.
Q: How many new questions does George have when he tries to use his questions?
Analysis: if you try to use more existing questions, you need to sort your questions by complexity from low to high, and traverse from start to end. If you can use them, use them (Greedy ). The requirements are also sorted to facilitate comparison.