from bisect import bisect_left, bisect_right
n, x = map(int, input().split())
array = list(map(int, input().split()))


def count_range(array, left, right):
    right_index = bisect_right(array, right)
    left_index = bisect_left(array, left)
    return right_index - left_index


count = count_range(array, x, x)
if count == 0:
    print(-1)
else:
    print(count)

f79760871a56ddbf99e9990027096dbfb2b6056b
<mask token>

<mask token>


def count_range(array, left, right):
    right_index = bisect_right(array, right)
    left_index = bisect_left(array, left)
    return right_index - left_index


<mask token>
if count == 0:
    print(-1)
else:
    print(count)

<mask token>
n, x = map(int, input().split())
array = list(map(int, input().split()))


def count_range(array, left, right):
    right_index = bisect_right(array, right)
    left_index = bisect_left(array, left)
    return right_index - left_index


count = count_range(array, x, x)
if count == 0:
    print(-1)
else:
    print(count)

from bisect import bisect_left, bisect_right
n, x = map(int, input().split())
array = list(map(int, input().split()))


def count_range(array, left, right):
    right_index = bisect_right(array, right)
    left_index = bisect_left(array, left)
    return right_index - left_index


count = count_range(array, x, x)
if count == 0:
    print(-1)
else:
    print(count)
