#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int P = 257;
int n, m;
long long p[600010];
void init() {
  p[0] = 1;
  for (int i = 1; i <= 600000; i++) p[i] = P * p[i - 1] % MOD;
}
long long get_hash(string s) {
  long long ret = 0;
  for (auto ch : s) {
    ret = (ret * P + ch) % MOD;
  }
  return ret;
}
set<long long> ss;
int main() {
  init();
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    string s;
    cin >> s;
    ss.insert(get_hash(s));
  }
  for (int i = 1; i <= m; i++) {
    string s;
    cin >> s;
    long long h = get_hash(s);
    int len = s.size();
    bool flg = 0;
    for (int j = 0; j < len; j++) {
      for (int k = 'a'; k <= 'c'; k++) {
        if (k == s[j]) continue;
        long long x = (h + p[len - j - 1] * (k - s[j]) + 3LL * MOD) % MOD;
        if (ss.count(x)) flg = 1;
      }
    }
    cout << (flg ? "YES" : "NO") << endl;
  }
  return 0;
}
