#include <bits/stdc++.h>
struct trie_node {
  int value;
  struct trie_node *children[(3)];
} alloc[600002], *ptr;
struct trie {
  struct trie_node *root;
  int count;
};
struct trie_node *getNode() {
  struct trie_node *pNode = NULL;
  pNode = (struct trie_node *)malloc(sizeof(struct trie_node));
  if (pNode) {
    int i;
    pNode->value = 0;
    for (i = 0; i < (3); i++) {
      pNode->children[i] = NULL;
    }
  }
  return pNode;
}
void initialize(struct trie *pTrie) {
  pTrie->root = ptr++;
  pTrie->count = 0;
}
void insert(struct trie *pTrie, char *key) {
  int level;
  int length = strlen(key);
  int index;
  struct trie_node *pCrawl;
  pTrie->count++;
  pCrawl = pTrie->root;
  for (level = 0; level < length; level++) {
    index = ((int)key[level] - (int)'a');
    if (!pCrawl->children[index]) {
      pCrawl->children[index] = ptr++;
    }
    pCrawl = pCrawl->children[index];
  }
  pCrawl->value = pTrie->count;
}
bool serch(struct trie_node *pCrawl, int l, int length, char *key) {
  if (!pCrawl) return false;
  int level, index;
  for (level = l; level < length; level++) {
    index = ((int)key[level] - (int)'a');
    if (!pCrawl->children[index]) {
      return false;
    }
    pCrawl = pCrawl->children[index];
  }
  return (0 != pCrawl && pCrawl->value);
}
void search(struct trie *pTrie, char *key) {
  int level;
  int length = strlen(key);
  int index;
  struct trie_node *pCrawl;
  pCrawl = pTrie->root;
  bool flag = false;
  for (level = 0; level < length; level++) {
    index = ((int)key[level] - (int)'a');
    if (key[level] == 'c') {
      if (serch(pCrawl->children[0], level + 1, length, key)) {
        printf("YES\n");
        flag = true;
        break;
      } else if (serch(pCrawl->children[1], level + 1, length, key)) {
        printf("YES\n");
        flag = true;
        break;
      }
    }
    if (key[level] == 'b') {
      if (serch(pCrawl->children[0], level + 1, length, key)) {
        printf("YES\n");
        flag = true;
        break;
      } else if (serch(pCrawl->children[2], level + 1, length, key)) {
        printf("YES\n");
        flag = true;
        break;
      }
    }
    if (key[level] == 'a') {
      if (serch(pCrawl->children[1], level + 1, length, key)) {
        printf("YES\n");
        flag = true;
        break;
      } else if (serch(pCrawl->children[2], level + 1, length, key)) {
        printf("YES\n");
        flag = true;
        break;
      }
    }
    if (!pCrawl->children[index]) {
      break;
    }
    pCrawl = pCrawl->children[index];
  }
  if (!flag) printf("NO\n");
}
int main() {
  ptr = &alloc[0];
  int n, m;
  scanf("%d %d", &n, &m);
  struct trie trie;
  initialize(&trie);
  char keys[600002];
  for (int i = 0; i < n; i++) {
    scanf("%s", keys);
    insert(&trie, keys);
  }
  while (m--) {
    scanf("%s", keys);
    search(&trie, keys);
  }
  return 0;
}
