#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-6;
const int N = 6e5 + 10;
const long long mod = 1e9 + 7;
const int P = 131;
char s[N];
int son[N][3];
int cnt[N];
int idx = 0;
inline long long read() {
  long long X = 0;
  bool flag = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') flag = 0;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    X = (X << 1) + (X << 3) + ch - '0';
    ch = getchar();
  }
  if (flag) return X;
  return ~(X - 1);
}
inline void write(long long x) {
  if (x < 0) x = ~x + 1, putchar('-');
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
void insert(char *s) {
  int p = 0;
  int l = strlen(s);
  for (int i = 0; i < l; ++i) {
    int u = s[i] - 'a';
    if (!son[p][u]) {
      son[p][u] = ++idx;
    }
    p = son[p][u];
  }
  cnt[p] = 1;
}
bool query(char *s, int rt, int p, int d, int l) {
  if (d > 1) return false;
  if (p == l) {
    if (d == 1 && cnt[rt]) return true;
    return false;
  }
  for (int i = 0; i < 3; ++i) {
    if (son[rt][i])
      if (query(s, son[rt][i], p + 1, d + (i != s[p] - 'a'), l)) return true;
  }
  return false;
}
int main() {
  int n = read(), m = read();
  for (int i = 1; i <= n; ++i) {
    scanf("%s", s);
    insert(s);
  }
  for (int i = 1; i <= m; ++i) {
    scanf("%s", s);
    if (query(s, 0, 0, 0, strlen(s)))
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
