#include <bits/stdc++.h>
using namespace std;
long long int n, t, x, q, o, m;
const long long int MAXN = 2e6 + 4;
string s;
std::vector<long long int> ans;
long long int p[MAXN + 852];
long long int p2[MAXN + 852];
long long int pref[MAXN], suff[MAXN];
long long int pref2[MAXN], suff2[MAXN];
long long int base = 7919, mod = 1e9 + 7;
long long int base2 = 6689, mod2 = 1e9 + 7;
long long int modrr = mod, baserr = base;
long long int hashh(string s) {
  long long int sum = 0;
  for (long long int i = 0; i < s.size(); i++) {
    long long int cur = s[i] - 'a' + 1;
    sum = (sum % mod + (cur * (p[i])) % mod) % mod;
    pref[i] = sum % mod;
  }
  for (long long int i = s.size(); i >= 0; i--) {
    if (i)
      suff[i] = (pref[s.size() - 1] - pref[i - 1] + mod) % mod;
    else
      suff[0] = pref[s.size() - 1] % mod;
  }
  return sum % mod;
}
long long int hashh2(string s) {
  long long int sum = 0;
  for (long long int i = 0; i < s.size(); i++) {
    long long int cur = s[i] - 'a' + 1;
    sum = (sum % mod + (cur * (p2[i])) % mod) % mod;
    pref2[i] = sum % mod;
  }
  for (long long int i = s.size(); i >= 0; i--) {
    if (i)
      suff2[i] = (pref2[s.size() - 1] - pref2[i - 1] + mod) % mod;
    else
      suff2[0] = pref2[s.size() - 1] % mod;
  }
  return sum % mod;
}
long long int mypow(long long int a, long long int b) {
  if (!b) return 1;
  long long int ret = mypow(a, b / 2) % mod;
  if (b % 2)
    return (((ret * ret) % mod) * a) % mod;
  else
    return (ret * ret) % mod;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  p[0] = 1;
  for (long long int i = 1; i <= MAXN; i++) {
    p[i] = (p[i - 1] * base) % mod;
  }
  p2[0] = 1;
  for (long long int i = 1; i <= MAXN; i++) {
    p2[i] = (p2[i - 1] * base2) % mod2;
  }
  cin >> n >> m;
  unordered_set<long long int> se;
  unordered_set<long long int> se2;
  for (long long int i = 0; i < n; i++) {
    cin >> s;
    hashh(s);
    hashh2(s);
    for (long long int j = 0; j < s.size(); j++) {
      long long int sss = 0;
      long long int coef = p[j];
      if (s[j] != 'a') {
        sss = (j) ? pref[j - 1] + suff[j + 1] : suff[j + 1];
        sss += coef;
        se.insert(sss % mod);
      }
      if (s[j] != 'b') {
        sss = (j) ? pref[j - 1] + suff[j + 1] : suff[j + 1];
        sss += (2 * coef) % mod;
        se.insert(sss % mod);
      }
      if (s[j] != 'c') {
        sss = (j) ? pref[j - 1] + suff[j + 1] : suff[j + 1];
        sss += (3 * coef) % mod;
        se.insert(sss % mod);
      }
    }
    mod = mod2;
    base = base2;
    for (long long int j = 0; j < s.size(); j++) {
      long long int sss = 0;
      long long int coef = p2[j];
      if (s[j] != 'a') {
        sss = (j) ? pref2[j - 1] + suff2[j + 1] : suff2[j + 1];
        sss += coef;
        se2.insert(sss % mod);
      }
      if (s[j] != 'b') {
        sss = (j) ? pref2[j - 1] + suff2[j + 1] : suff2[j + 1];
        sss += (2 * coef) % mod;
        se2.insert(sss % mod);
      }
      if (s[j] != 'c') {
        sss = (j) ? pref2[j - 1] + suff2[j + 1] : suff2[j + 1];
        sss += (3 * coef) % mod;
        se2.insert(sss % mod);
      }
    }
    mod = modrr;
    base = baserr;
  }
  while (m--) {
    std::cin >> s;
    if (se.find(hashh(s) % mod) != se.end()) {
      base = base2;
      mod = mod2;
      if (se2.find(hashh2(s) % mod) != se2.end())
        std::cout << "YES" << '\n';
      else
        std::cout << "NO" << '\n';
    } else {
      std::cout << "NO" << '\n';
    }
    mod = modrr;
    base = baserr;
  }
}
