using namespace std; const int N = 100010; void check(long long arr[], long long a, long long n) {
long long l = 0, r = n - 1;
while (l < r)
{
long long mid = (l + r) >> 1;
if (a <= arr[mid])r = mid;
else l = mid + 1;
}
if (arr[l] == a)cout << "YES" << endl;
else cout << "NO" << endl;
} int main() {
ios::sync_with_stdio(false);
long long n, m;
cin >> n >> m;
long long arr[N];
for (int i = 0; i < n; i++)cin >> arr[i];
for (int i = 0; i < m; i++)
{
long long temp = 0;
cin >> temp;
check(arr, temp, n);
}
return 0;
}
r = mid - 1 考虑到最后 l = r的情况,这时候会一直卡在while上