CF862A.Mahmoud and Ehab and the MEX

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Dr. Evil kidnapped Mahmoud and Ehab in the evil land because of their performance in the Evil Olympiad in Informatics (EOI). He decided to give them some problems to let them go.

Dr. Evil is interested in sets, He has a set of nn integers. Dr. Evil calls a set of integers evil if the MEX of it is exactly xx . the MEX of a set of integers is the minimum non-negative integer that doesn't exist in it. For example, the MEX of the set 0,2,4{0,2,4} is 11 and the MEX of the set 1,2,3{1,2,3} is 00 .

Dr. Evil is going to make his set evil. To do this he can perform some operations. During each operation he can add some non-negative integer to his set or erase some element from it. What is the minimal number of operations Dr. Evil has to perform to make his set evil?

输入格式

The first line contains two integers nn and xx ( 1<=n<=1001<=n<=100 , 0<=x<=1000<=x<=100 ) — the size of the set Dr. Evil owns, and the desired MEX.

The second line contains nn distinct non-negative integers not exceeding 100100 that represent the set.

输出格式

The only line should contain one integer — the minimal number of operations Dr. Evil should perform.

输入输出样例

  • 输入#1

    5 3
    0 4 5 6 7
    

    输出#1

    2
    
  • 输入#2

    1 0
    0
    

    输出#2

    1
    
  • 输入#3

    5 0
    1 2 3 4 5
    

    输出#3

    0
    

说明/提示

For the first test case Dr. Evil should add 11 and 22 to the set performing 22 operations.

For the second test case Dr. Evil should erase 00 from the set. After that, the set becomes empty, so the MEX of it is 00 .

In the third test case the set is already evil.

首页