
from bisect import bisect_right, bisect_left
def count_x(x, arr):
left = bisect_left(arr, x)
right = bisect_right(arr, x)
return right - left if right > left else -1
n, x = list(map(int, input().split(' ')))
arr = list(map(int, input().split(' ')))
result = count_x(x, arr)
print(result)