1 #include <bits/stdc++.h> 2 3 using namespace std; 4 5 int main() { 6 std::ios_base::sync_with_stdio(false); 7 cin.tie(0); 8 cout.tie(0); 9 int n, k; 10 cin >> n >> k; 11 int a[n]; 12 for (int i = 0; i < n; ++i) { 13 cin >> a[i]; 14 } 15 16 for (int i = 0; i < k; ++i) { 17 int x; 18 cin >> x; 19 // a[j - 1] < x <= a[j] 20 int j = (lower_bound(a + 0, a + n, x) - a); 21 22 if (j == n || x < a[j]) { 23 cout << "NO" << endl; 24 } else { 25 cout << "YES" << endl; 26 } 27 } 28 29 return 0; 30 } 31