from bisect import bisect_left
n, m = map(int, input().split())
nums = list(map(int, input().split()))
index = bisect_left(nums, m)
if 0 <= index < n and nums[index] == m:
    print(index)
else:
    print(-1)