#P2649. 游戏预言

游戏预言

Description

John and his friends are playing a card game with mm people in total (including John). Their deck is special: there are n×mn \times m cards numbered 1,2,,n×m1, 2, \dots, n \times m, with no duplicate numbers. Each person first receives nn cards. Then, in each round, everyone plays one card; the highest number wins that round. Now, given the nn cards in John's hand, compute the minimum number of rounds he can win.

Input Format

The first line contains two integers mm and nn.

The second line contains nn positive integers, the values of the nn cards in John's hand.

Output Format

Output a single integer, the minimum number of rounds John can win.

2 5
1 7 2 10 9
2
6 11
62 63 54 66 65 61 57 56 50 53 48
4

Hint

Constraints: For 100%100\% of the testdata, 2m202 \le m \le 20, 1n501 \le n \le 50.

Translated by ChatGPT 5