#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9;
const long long mod = 1e9 + 7;
const double eps = 1e-8;
const long long MAX = 1e7 + 20;
template <class T>
T gcd(T a, T b) {
  return (b != 0 ? gcd<T>(b, a % b) : a);
}
template <class T>
T lcm(T a, T b) {
  return (a / gcd<T>(a, b) * b);
}
long long BM(long long B, long long P, long long M) {
  long long R = 1;
  while (P > 0) {
    if (P & 1) {
      R = (R * B) % M;
    }
    P /= 2;
    B = (B * B) % M;
  }
  return (long long)R;
}
long long MI(long long x, long long m) { return BM(x, m - 2, m); }
struct data {
  bool endmark;
  int next[5];
  data() {
    endmark = false;
    memset(next, -1, sizeof(next));
  }
} trie[600005];
int tot = 0, sz;
string s;
void add(string s) {
  int cur = 0;
  for (int i = 0; i < s.size(); i++) {
    int ch = s[i] - 'a';
    if (trie[cur].next[ch] == -1) {
      trie[++tot] = data();
      trie[cur].next[ch] = tot;
    }
    cur = trie[cur].next[ch];
  }
  trie[cur].endmark = true;
}
bool findmatch(int pos, int cur, bool change) {
  if (pos == sz) {
    return (change and trie[cur].endmark);
  }
  bool ret = false;
  int now = s[pos] - 'a';
  if (change) {
    if (trie[cur].next[now] == -1) return false;
    return findmatch(pos + 1, trie[cur].next[now], change);
  } else {
    for (int i = 0; i < 3; i++) {
      if (trie[cur].next[i] == -1) continue;
      ret |= findmatch(pos + 1, trie[cur].next[i], (i == now) ? 0 : 1);
    }
  }
  return ret;
}
int main() {
  trie[0] = data();
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> s;
    add(s);
  }
  while (m--) {
    cin >> s;
    sz = s.size();
    if (findmatch(0, 0, 0))
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
