P2649 Game Prediction

Description

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

Input Format

The first line contains two integers $m$ and $n$. The second line contains $n$ positive integers, the values of the $n$ cards in John's hand.

Output Format

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

Explanation/Hint

Constraints: For $100\%$ of the testdata, $2 \le m \le 20$, $1 \le n \le 50$. Translated by ChatGPT 5