Codeforces Round #435 (Div. 2), problem: (A) Mahmoud and Ehab and the MEX
- import sys
- # sys.stdin = open('input.txt', 'r')
- # sys.stdout = open('output.txt', 'w')
- # sys.setrecursionlimit(1000000)
- def Ints(): return map(int, sys.stdin.readline().strip().split())
- def Strs(): return map(str, sys.stdin.readline().strip().split())
- def Array(): return list(map(int, sys.stdin.readline().strip().split()))
- def Str(): return sys.stdin.readline().strip()
- def Int(): return int(sys.stdin.readline().strip())
- def MOD(): return 1000000007
- def power(base, power):
- MOD = 1000000007
- result = 1
- while power > 0:
- if power % 2 == 1:
- result = (result * base) % MOD
- power = power // 2
- base = (base * base) % MOD
- return result
- if __name__ == "__main__":
- n , x = Ints()
- a = Array()
- sa = set(a)
- count = 0
- for i in range(x):
- if i not in sa:
- count += 1
- if x in sa: count += 1
- print(count)
Comments
Post a Comment