P16460 [UOI 2026] Minimum Deletion
Description
You are given an array $a$ of $n$ non-negative integers from $0$ to $9$.
You are allowed to perform the following operation:
- choose one element and delete it from the array.
You need to find the minimum number of operations after which the smallest missing non-negative integer will be no greater than $k$.
Input Format
The first line contains two integers $n$ and $k$ $(1 \le n \le 10^3, 0 \le k \le 10)$ --- the number of elements in the array and the given number.
The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ $(0 \le a_i \le 9)$ --- the elements of the array.
Output Format
Print one integer --- the minimum number of elements that need to be deleted.
Explanation/Hint
In the first example, it is necessary to make the smallest missing element of the array no greater than $2$.
The best choice is to delete all occurrences of the number $2$. This requires $2$ operations.
After that, the number $2$ will be missing from the array, so the smallest missing element of the array will be equal to $2$.
In the second example, the number $0$ is already missing from the array. Since $0 \le 5$, no operations are needed.
In the third example, all elements of the array are no greater than $9$, so the number $10$ is definitely missing from the array. Since $10 \le 10$, no operations are needed.
### Scoring
- ($12$ points): $k=10$;
- ($17$ points): $k=0$;
- ($32$ points): all values $a_i$ are pairwise distinct;
- ($39$ points): no additional constraints.