#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  return x * f;
}
const int MAXN = 600010;
const long long BASE0 = 233333;
const long long BASE1 = 999983;
const long long P0 = 998244353;
const long long P1 = 1000000009;
int N, M;
char str[MAXN + 1];
long long pw0[MAXN + 1], pw1[MAXN + 1], pre0[MAXN + 1], pre1[MAXN + 1],
    suf0[MAXN + 1], suf1[MAXN + 1];
map<pair<long long, long long>, bool> vis;
int main() {
  N = read(), M = read();
  while (N--) {
    scanf("%s", str + 1);
    int L = strlen(str + 1);
    long long k0 = 0, k1 = 0;
    for (int i = 1; i <= L; i++) {
      k0 = ((long long)k0 * BASE0 + str[i]) % P0;
      k1 = ((long long)k1 * BASE1 + str[i]) % P1;
    }
    vis[make_pair(k0, k1)] = 1;
  }
  pw0[0] = pw1[0] = 1;
  for (int i = 1; i <= MAXN; i++) {
    pw0[i] = (long long)pw0[i - 1] * BASE0 % P0;
    pw1[i] = (long long)pw1[i - 1] * BASE1 % P1;
  }
  while (M--) {
    scanf("%s", str + 1);
    int L = strlen(str + 1);
    pre0[0] = pre1[0] = suf0[L + 1] = suf1[L + 1] = 0;
    for (int i = 1; i <= L; i++) {
      pre0[i] = ((long long)pre0[i - 1] * BASE0 + str[i]) % P0;
      pre1[i] = ((long long)pre1[i - 1] * BASE1 + str[i]) % P1;
    }
    for (int i = L; i >= 1; i--) {
      suf0[i] = ((long long)suf0[i + 1] + (long long)str[i] * pw0[L - i]) % P0;
      suf1[i] = ((long long)suf1[i + 1] + (long long)str[i] * pw1[L - i]) % P1;
    }
    bool flag = 0;
    for (int i = 1; i <= L; i++) {
      long long pr0 = pre0[i - 1], pr1 = pre1[i - 1];
      long long su0 = suf0[i + 1], su1 = suf1[i + 1];
      for (char c = 'a'; c <= 'c'; c++) {
        if (c == str[i]) continue;
        long long V0 =
            (((long long)pr0 * BASE0 + c) % P0 * pw0[L - i] % P0 + su0) % P0;
        long long V1 =
            (((long long)pr1 * BASE1 + c) % P1 * pw1[L - i] % P1 + su1) % P1;
        if (vis[make_pair(V0, V1)]) {
          flag = 1;
          break;
        }
      }
      if (flag) break;
    }
    printf(flag ? "YES\n" : "NO\n");
  }
  return 0;
}
