#P16460. [UOI 2026] Minimum Deletion

[UOI 2026] Minimum Deletion

题目描述

You are given an array aa of nn non-negative integers from 00 to 99.

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 kk.

输入格式

The first line contains two integers nn and kk (1n103,0k10)(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 nn integers a1,a2,,ana_1, a_2, \ldots, a_n (0ai9)(0 \le a_i \le 9) --- the elements of the array.

输出格式

Print one integer --- the minimum number of elements that need to be deleted.

10 2
0 0 1 0 1 2 0 9 2 1
2
8 5
1 4 2 3 7 5 9 8
0
10 10
0 1 2 3 4 5 6 7 8 9
0

提示

In the first example, it is necessary to make the smallest missing element of the array no greater than 22.

The best choice is to delete all occurrences of the number 22. This requires 22 operations.

After that, the number 22 will be missing from the array, so the smallest missing element of the array will be equal to 22.

In the second example, the number 00 is already missing from the array. Since 050 \le 5, no operations are needed.

In the third example, all elements of the array are no greater than 99, so the number 1010 is definitely missing from the array. Since 101010 \le 10, no operations are needed.

Scoring

  • (1212 points): k=10k=10;
  • (1717 points): k=0k=0;
  • (3232 points): all values aia_i are pairwise distinct;
  • (3939 points): no additional constraints.