#include <bits/stdc++.h>
using namespace std;
int ch[600010][4], tot;
char s[600100];
bool fl[600010];
void insert(char *r) {
  int l = strlen(r);
  int rt = 0;
  for (int x = 0; x < l; x++) {
    int t = r[x] - 'a';
    if (!ch[rt][t]) ch[rt][t] = ++tot;
    rt = ch[rt][t];
  }
  fl[rt] = 1;
}
bool find(char *r, bool vis) {
  int l = strlen(r);
  int rt = 0;
  for (int x = 0; x < l; x++) {
    int t = r[x] - 'a';
    if (!ch[rt][t]) return 0;
    rt = ch[rt][t];
  }
  if (fl[rt]) return 1;
  return 0;
}
bool dfs(int rt, char *s, bool vis) {
  if ((*s) == '\0') return vis & fl[rt];
  int t = (*s) - 'a';
  bool l = 0;
  for (int x = 0; x < 3; x++) {
    if (ch[rt][x]) {
      if (x == t)
        l |= dfs(ch[rt][x], s + 1, vis);
      else if (!vis)
        l |= dfs(ch[rt][x], s + 1, 1);
    }
  }
  return l;
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int x = 1; x <= n; x++) scanf("%s", s), insert(s);
  for (int x = 1; x <= m; x++) {
    scanf("%s", s);
    if (dfs(0, s, 0))
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
