from bisect import bisect_left, bisect_right n, x = map(int, input().split()) array = list(map(int, input().split())) diff = bisect_right(array, x) - bisect_left(array, x) if diff == 0: print(-1) else: print(diff)