#include <bits/stdc++.h>
using namespace std;
const long long N = 1000001, A = 11, MOD = 1110111110111;
long long n, m, base[N];
set<long long> S;
string t;
long long get_hash(string &s) {
  long long ret = 0;
  for (long long i = 0; i < s.size(); i++) {
    ret += s[i] * base[i];
    ret %= MOD;
  }
  return ret;
}
int32_t main() {
  base[0] = 1;
  for (long long i = 1; i < N; i++) base[i] = base[i - 1] * A % MOD;
  cin >> n >> m;
  while (n--) {
    cin >> t;
    S.insert(get_hash(t));
  }
  while (m--) {
    bool ok = 0;
    cin >> t;
    long long h = get_hash(t);
    for (long long i = 0; i < t.size(); i++)
      for (long long j = 'a'; j < 'd'; j++)
        if (j != t[i])
          ok |= S.count((h + (j - t[i]) * base[i] + 4 * MOD) % MOD);
    cout << (ok ? "YES\n" : "NO\n");
  }
}
