logo AlgoBeat OnlineJudge
登录 注册

#216503. [UOI 2026] Minimum Deletion

内存限制:512 MiB 时间限制:300 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

You are given an array of non-negative integers from to .

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 .

输入格式

The first line contains two integers and --- the number of elements in the array and the given number.

The second line contains integers --- the elements of the array.

输出格式

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

样例

样例输入 1

10 2
0 0 1 0 1 2 0 9 2 1

样例输出 1

2

样例输入 2

8 5
1 4 2 3 7 5 9 8

样例输出 2

0

样例输入 3

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

样例输出 3

0

数据范围与提示

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

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

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

In the second example, the number is already missing from the array. Since , no operations are needed.

In the third example, all elements of the array are no greater than , so the number is definitely missing from the array. Since , no operations are needed.

Scoring

  • ( points): ;
  • ( points): ;
  • ( points): all values are pairwise distinct;
  • ( points): no additional constraints.