#include <bits/stdc++.h>
using namespace std;
const int MAXN = 601000;
struct note {
  int ne[3], whe;
  note() { whe = ne[0] = ne[1] = ne[2] = 0; }
} a[MAXN];
int n, m, kst, ka, root, p, q;
char st[MAXN];
pair<pair<int, int>, bool> dl[MAXN << 2];
int check() {
  dl[p = q = 0] = make_pair(make_pair(0, root), 0);
  while (p <= q) {
    pair<pair<int, int>, bool> u = dl[p++];
    if (a[u.first.second].ne[st[u.first.first] - 'a']) {
      dl[++q] =
          make_pair(make_pair(u.first.first + 1,
                              a[u.first.second].ne[st[u.first.first] - 'a']),
                    u.second);
      if (dl[q].first.first == kst) {
        if (dl[q].second && a[dl[q].first.second].whe)
          return 1;
        else
          --q;
      }
    }
    if (!u.second)
      for (int i = 0; i < 3; ++i)
        if (i + 'a' != st[u.first.first] && a[u.first.second].ne[i]) {
          dl[++q] = make_pair(
              make_pair(u.first.first + 1, a[u.first.second].ne[i]), 1);
          if (dl[q].first.first == kst) {
            if (dl[q].second && a[dl[q].first.second].whe)
              return 1;
            else
              --q;
          }
        }
  }
  return 0;
}
int main() {
  scanf("%d%d\n", &n, &m);
  while (n--) {
    scanf("%s", st);
    kst = strlen(st);
    int u = root;
    for (int(i) = (0), (_end_) = (kst - 1); (i) <= (_end_); ++(i)) {
      if (!a[u].ne[st[i] - 'a']) a[u].ne[st[i] - 'a'] = ++ka;
      u = a[u].ne[st[i] - 'a'];
    }
    a[u].whe = 1;
  }
  while (m--) {
    scanf("%s", st);
    kst = strlen(st);
    if (check())
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
