Problem: You are given an array A of size N, and Q queries to deal with. For each query, you are given an integer X, and you're supposed to find out if X is present in the array A or not.

Input:
The first line contains two integers, N and Q, denoting the size of array A and number of queries. The second line contains N space separated integers, denoting the array of elements Ai. The next Q lines contain a single integer X per line.

Output:
For each query, print YES if the X is in the array, otherwise print NO.

Constraints:
1 ≤ N, Q ≤ 10^5
1 ≤ Ai ≤ 10^9
1 ≤ X ≤ 10^9

SAMPLE INPUT
5 10
50 40 30 20 10
10
20
30
40
50
60
70
80
90
100

SAMPLE OUTPUT
YES
YES
YES
YES
YES
NO
NO
NO
NO
NO

Solution (in PYTHON):

Solution:
'''
You are given an array A of size N, and Q queries to deal with. For each query, you are given an integer X, and you're supposed to find out if X is present in the array A or not.

Input:
The first line contains two integers, N and Q, denoting the size of array A and number of queries. The second line contains N space separated integers, denoting the array of elements Ai. The next Q lines contain a single integer X per line.

Output:
For each query, print YES if the X is in the array, otherwise print NO.

Constraints:
1 <= N, Q <= 105
1 <= Ai <= 109
1 <= X <= 109

SAMPLE INPUT
5 10
50 40 30 20 10
10
20
30
40
50
60
70
80
90
100
SAMPLE OUTPUT
YES
YES
YES
YES
YES
NO
NO
NO
NO
NO
'''

def merge_sort(items):
    #print 'Inside merge_sort: {0}'.format(items)
    if len(items) == 1:
        return items

    if len(items) > 1:
        mid = len(items) / 2
        left = items[:mid]
        right = items[mid:]

        merge_sort(left)
        merge_sort(right)

        i,j,k = 0,0,0

        while i < len(left) and j < len(right):
            if left[i] > right[j]:
                items[k] = left[i]
                i += 1
            else:
                items[k] = right[j]
                j += 1
            k += 1

        while i < len(left):
            items[k] = left[i]
            i += 1
            k += 1
        while j < len(right):
            items[k] = right[j]
            j += 1
            k += 1

    return items

def binary_search(items, start, end, search_item):
    #print items

    if start <= end:

        #start = 0
        #end = len(items) - 1
        mid = start + (end - start) / 2

        if items[mid] == search_item:
            print 'YES'
        elif items[mid] > search_item:
            binary_search(items, mid + 1, end, search_item)
        else:
            binary_search(items, start, mid - 1, search_item)

    else:
        print 'NO'


def check_number_in_list():
    size_of_array, no_of_queries = [int(x) for x in raw_input().split(' ')]
    items = [int(x) for x in raw_input().split(' ')] #This array needs to be sorted before applying for binary_search
    #print 'Before sorting {0}'.format(items)
    merge_sort(items)
    #print 'After sorting {0}'.format(items)
    for _ in range(no_of_queries):
        search_item = int(raw_input())
        binary_search(items, 0, len(items)-1, search_item)

check_number_in_list()