#include <bits/stdc++.h>
using namespace std;
const int p1 = 1331;
const int p2 = 809;
const int MOD1 = 1940839441;
const int MOD2 = 1813295219;
const int MAXN = 6 * 100000 + 1;
const char ch[3] = {'a', 'b', 'c'};
int pows1[MAXN];
int pows2[MAXN];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  pows1[0] = pows2[0] = 1;
  for (int i = (1); i < (MAXN); ++i) {
    pows1[i] = (1LL * pows1[i - 1] * p1) % MOD1;
    pows2[i] = (1LL * pows2[i - 1] * p2) % MOD2;
  }
  set<pair<int, int> > a;
  int n, m;
  cin >> n >> m;
  for (int i = (0); i < (n); ++i) {
    string s;
    cin >> s;
    int h1 = 0, h2 = 0;
    for (char c : s) {
      h1 = (1LL * h1 * p1 + c) % MOD1;
      h2 = (1LL * h2 * p2 + c) % MOD2;
    }
    a.insert({h1, h2});
  }
  for (int i = (0); i < (m); ++i) {
    string s;
    cin >> s;
    int h1 = 0, h2 = 0;
    for (char c : s) {
      h1 = (1LL * h1 * p1 + c) % MOD1;
      h2 = (1LL * h2 * p2 + c) % MOD2;
    }
    int st = (int)s.size() - 1;
    assert(st >= 0);
    bool chi = false;
    for (int j = (0); j < ((int)s.size()); ++j) {
      int nh1 = h1, nh2 = h2;
      nh1 = (nh1 + 1LL * MOD1 - 1LL * s[j] * pows1[st]) % MOD1;
      nh2 = (nh2 + 1LL * MOD2 - 1LL * s[j] * pows2[st]) % MOD2;
      for (int k = (0); k < (3); ++k) {
        if (s[j] == ch[k]) continue;
        if (a.find({(nh1 + 1LL * ch[k] * pows1[st]) % MOD1,
                    (nh2 + 1LL * ch[k] * pows2[st]) % MOD2}) != a.end()) {
          chi = true;
        }
      }
      --st;
    }
    if (chi)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
