A. [2025 实验室二面] 无语,跟你说不下去,典型的特大男人思维

    传统题 1000ms 256MiB

[2025 实验室二面] 无语,跟你说不下去,典型的特大男人思维

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Background

XL TECHNO -More Dance Remix- is a very attractive song, and its chart on Chunithm is equally charming and loved by players.

A senior in the lab has been training hard to achieve All Justice on XL TECHNO -More Dance Remix-, but each time he practices he always misses some note. Impatient, he decides to modify the chart to lock down the note on which he always makes a mistake.

Description

You are given an array aa of length nn and a number kk, where 0kn0 \le k \le n. In one operation, you can choose any index ii (1in1 \le i \le n) and set aia_i to any integer value xx from the range [0,n][0,n]. Find the minimum number of such operations required to satisfy the condition: MEX(a)=k.\mathrm{MEX}(a) = k.

*Here, the minimum excluded (MEX) of a set of numbers a1,a2,,ana_1,a_2,\dots,a_n is the smallest non‐negative integer xx that does not appear among the aia_i.


Input

The first line contains an integer tt (1t1041\le t\le 10^4), the number of test cases. Then follow tt test cases, each in the following format: A line with two integers nn and kk (1n21051\le n\le 2\cdot 10^5, 0kn0\le k\le n), the length of the array and the required MEX. A line with nn integers a1,a2,,ana_1,a_2,\dots,a_n (0ain0\le a_i\le n), the elements of the array.

It is guaranteed that the sum of nn over all test cases does not exceed 21052\cdot 10^5.

Output

For each test case, output a single integer—the minimum number of operations needed to make MEX(a)=k\mathrm{MEX}(a)=k.

Sample

Input #1

5
1 0
0
3 1
0 2 3
5 5
0 1 2 3 4
6 2
0 3 4 2 6 2
7 4
0 1 5 4 4 7 3

Output #1

1
0
0
2
2

Explanation #1

In the first test case, the array is [0][0], so MEX=1\mathrm{MEX}=1. By removing the 0 (or replacing it with any x[1,n]x\in[1,n]), we obtain MEX=0\mathrm{MEX}=0. Thus exactly one operation is required.

In the third test case, the array already contains all numbers 0,1,2,3,40,1,2,3,4, so initially MEX(a)=5\mathrm{MEX}(a)=5. Since this matches the required kk, no changes are needed and the minimum number of operations is 00.

2025实验室二面(线上同步赛)

未参加
状态
已结束
规则
ACM/ICPC
题目
10
开始于
2025-10-26 14:15
结束于
2025-10-26 18:15
持续时间
4 小时
主持人
参赛人数
41