#include <bits/stdc++.h>
char a[600005], b[600005];
int len, flag2;
typedef struct node {
  struct node *child[3];
  int n, len;
} Trie;
Trie *root;
Trie *Init() {
  Trie *p;
  int i;
  p = (Trie *)malloc(sizeof(Trie));
  for (i = 0; i < 3; i++) p->child[i] = NULL;
  p->n = 1;
  p->len = 0;
  return p;
}
void insert(char str[]) {
  int i, id, len1 = strlen(str);
  Trie *p = root, *q;
  for (i = 0; i < len1; i++) {
    id = str[i] - 'a';
    if (p->child[id] == NULL) {
      q = Init();
      p->child[id] = q;
    }
    p = p->child[id];
    if (p->len < len1) p->len = len1;
  }
  p->n = -1;
}
void find(Trie *p, char str[], int k, int flag) {
  int i, j;
  if (flag2) return;
  if (k == len) {
    if (p->n == -1 && flag == 1) flag2 = 1;
    return;
  }
  for (i = 0; i < 3; i++)
    if (p->child[i] != NULL && k < len && p->child[i]->len >= len) {
      if (i == str[k] - 'a') {
        find(p->child[str[k] - 'a'], b, k + 1, flag);
      } else if (flag < 1)
        find(p->child[i], b, k + 1, flag + 1);
    }
}
int main() {
  int n, m, ii, jj;
  scanf("%d%d", &n, &m);
  getchar();
  root = Init();
  for (ii = 0; ii < n; ii++) {
    scanf("%s", a);
    getchar();
    insert(a);
  }
  for (jj = 0; jj < m; jj++) {
    scanf("%s", b);
    getchar();
    len = strlen(b);
    flag2 = 0;
    find(root, b, 0, 0);
    if (flag2)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
