n, q = map(int, input().split())
l = list(map(int, input().split()))
for i in range(q):
flag = False
L = 0
R = n
s, nu = input().split()
nu = int(nu)
while L<R:
mid = (L+R)//2
if l[mid] == nu:
flag =True
print(1)
break
elif l[mid] > nu:
R = mid
elif l[mid] < nu:
L = mid + 1
if not flag:
print(0)
To embed this project on your website, copy the following code and paste it into your website's HTML: