#include <bits/stdc++.h>
typedef struct trie {
  struct trie *child[3];
  int isLeaf;
} TRIE;
int found;
TRIE *createNode() {
  int i;
  TRIE *node = (TRIE *)malloc(sizeof(TRIE));
  for (i = 0; i < 3; i++) node->child[i] = NULL;
  node->isLeaf = 0;
  return node;
}
void insert(TRIE *root, char a[]) {
  TRIE *temp = root;
  int i, index;
  for (i = 0; a[i]; i++) {
    index = a[i] - 'a';
    if (temp->child[index] == NULL) temp->child[index] = createNode();
    temp = temp->child[index];
  }
  temp->isLeaf = 1;
}
void search(TRIE *root, char a[], int pos, int mis) {
  if (found || a[pos] == '\0') return;
  TRIE *t = root;
  int i, index, m;
  index = a[pos] - 'a';
  for (i = 0; i < 3; i++) {
    if (t->child[i]) {
      m = mis;
      if (i != index) m += 1;
      if (m == 1 && a[pos + 1] == '\0' && t->child[i]->isLeaf)
        found = 1;
      else if (m < 2)
        search(t->child[i], a, pos + 1, m);
    }
  }
}
int main() {
  TRIE *root;
  int n, m;
  char str[600001];
  root = createNode();
  scanf("%d %d", &n, &m);
  while (n--) {
    scanf("%s", str);
    insert(root, str);
  }
  while (m--) {
    scanf("%s", str);
    found = 0;
    search(root, str, 0, 0);
    if (found)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
