#include <bits/stdc++.h>
using namespace std;
int ck(int n, int m) {
  if (n == 1 && m == 1) {
    string s1, s2;
    cin >> s1 >> s2;
    if (s1.size() != s2.size()) {
      cout << "NO";
      return 0;
    }
    int f = 0;
    for (int i = 0; i < s1.size(); i++) {
      if (s1[i] != s2[i]) {
        f++;
      }
    }
    if (f != 1) {
      cout << "NO";
      return 0;
    }
  }
  return 1;
}
int n, m, abc1[] = {23, 47, 71}, abc2[] = {5, 3, 2};
long long plist[600005], hs1, hs2, hs3, hs4;
pair<long long, long long> tmp;
pair<long long, long long> has(string s, int l) {
  long long h1 = 0, h2 = 0;
  for (int j = 0; j < l; j++) {
    h1 = (h1 + (abc1[(s[j] - 'a')] * plist[j])) % 96001748941;
    h2 = (h2 + (abc2[(s[j] - 'a')] * plist[j])) % 96001748941;
  }
  return make_pair(h1, h2);
}
void h(string s, int i, long long h1, long long h2) {
  h1 += 96001748941;
  h2 += 96001748941;
  h1 -= (abc1[s[i] - 'a'] * plist[i]) % 96001748941;
  h2 -= (abc2[s[i] - 'a'] * plist[i]) % 96001748941;
  h1 %= 96001748941;
  h2 %= 96001748941;
  int d1, d2, d3, d4;
  if (s[i] == 'a') {
    d1 = abc1[1];
    d2 = abc1[2];
    d3 = abc2[1];
    d4 = abc2[2];
  } else if (s[i] == 'b') {
    d1 = abc1[0];
    d2 = abc1[2];
    d3 = abc2[0];
    d4 = abc2[2];
  } else {
    d1 = abc1[0];
    d2 = abc1[1];
    d3 = abc2[0];
    d4 = abc2[1];
  }
  hs1 = ((h1 + (d1 * plist[i])) % 96001748941);
  hs2 = ((h1 + (d2 * plist[i])) % 96001748941);
  hs3 = ((h2 + (d3 * plist[i])) % 96001748941);
  hs4 = ((h2 + (d4 * plist[i])) % 96001748941);
}
int main() {
  plist[0] = 1;
  for (int i = 1; i < 600005; i++) {
    plist[i] = (plist[i - 1] * 31) % 96001748941;
  }
  cin >> n >> m;
  if (ck(n, m) == 0) return 0;
  set<pair<int, pair<long long, long long>>> hashset;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    int l = s.size();
    tmp = has(s, l);
    hashset.insert({l, {tmp.first, tmp.second}});
  }
  for (int i = 0; i < m; i++) {
    string s;
    cin >> s;
    int l = s.size();
    bool flag1 = false, flag2 = false;
    tmp = has(s, l);
    for (int j = 0; j < l; j++) {
      h(s, j, tmp.first, tmp.second);
      if (hashset.find({l, {hs1, hs3}}) != hashset.end() ||
          hashset.find({l, {hs2, hs4}}) != hashset.end()) {
        flag1 = true;
        cout << "YES\n";
        break;
      }
    }
    if (!flag1) {
      cout << "NO\n";
    }
  }
  return 0;
}
