304520: CF862A. Mahmoud and Ehab and the MEX
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Mahmoud and Ehab and the MEX
题意翻译
**题意描述** 在一片邪恶之地,邪恶博士绑架了Mahmoud和Ehab,因为他们在邪恶信息学奥林匹克竞赛(Evil Olympiad in Informatics,EOI)中的突出表现。邪恶博士又决定给他们一些问题让他们回答。问题如下: 邪恶博士对集合很感兴趣。他有一个包含n个整数的集合。邪恶博士认为,如果一个集合的Mex值恰好为x,那么这个集合就是邪恶的。定义Mex值为一个集合中没有出现的最小非负整数。举个例子,Mex({0,2,4}) = 1,Mex({1,2,3}) = 0 。 邪恶博士想让他的集合变得邪恶,因此他会执行一些操作。在每个操作中他可能会加入一个非负整数,也可能删去一个数。请问最少需要多少次操作才能让邪恶博士的集合变得邪恶? **输入输出格式** **输入格式:** 第一行,包括两个整数n和x,意义如上述。1<=n<=100,1<=x<=100. 第二行,包括n个不同的非负整数,且每个数均不超过100,表示一开始集合中的元素。 **输出格式:** 仅输出一行,表示邪恶博士最少需要执行多少次操作。题目描述
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 $ n $ integers. Dr. Evil calls a set of integers evil if the MEX of it is exactly $ x $ . 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} $ is $ 1 $ and the MEX of the set $ {1,2,3} $ is $ 0 $ . 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 $ n $ and $ x $ ( $ 1<=n<=100 $ , $ 0<=x<=100 $ ) — the size of the set Dr. Evil owns, and the desired MEX. The second line contains $ n $ distinct non-negative integers not exceeding $ 100 $ 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