#include <bits/stdc++.h>
using namespace std;
map<string, long long> mp;
long long i, j;
vector<string> v[600009];
int main() {
  long long n, m;
  cin >> n >> m;
  string s;
  while (n--) {
    cin >> s;
    v[s.size()].push_back(s);
  }
  while (m--) {
    cin >> s;
    if (mp[s] == 1)
      cout << "YES" << '\n';
    else if (mp[s] == 2)
      cout << "NO" << '\n';
    else {
      long long c = 0;
      long long l = s.size();
      long long z = v[l].size();
      for (i = 0; i < z; i++) {
        c = 0;
        for (j = 0; j < l; j++) {
          if (v[l][i][j] != s[j]) c++;
          if (c > 1) {
            break;
          }
        }
        if (c == 1) {
          cout << "YES" << '\n';
          mp[s] = 1;
          break;
        }
      }
      if (c != 1) {
        cout << "NO" << '\n';
        mp[s] = 2;
      }
    }
  }
  return 0;
}
