#include <bits/stdc++.h>
using namespace std;
struct node {
  bool endmark;
  node* next[3];
  node() {
    endmark = false;
    for (int i = 0; i < 3; i++) next[i] = NULL;
  }
} * root;
string strr;
void insert(int len) {
  node* curr = root;
  for (int i = 0; i < len; i++) {
    int id = strr[i] - 'a';
    if (curr->next[id] == NULL) curr->next[id] = new node();
    curr = curr->next[id];
  }
  curr->endmark = true;
}
bool found = false;
string str;
void search(int sz, int len, int diff, node* curr) {
  if (diff >= 2) return;
  if (len == sz) {
    if (curr->endmark && diff == 1) found = true;
    return;
  }
  if (found) return;
  int id = str[len] - 'a';
  if (curr->next[id] != NULL) {
    search(sz, len + 1, diff, curr->next[id]);
  }
  if (found) return;
  if (diff == 0)
    for (int i = 0; i < 3; i++) {
      if (found) return;
      if (id != i && curr->next[i] != NULL)
        search(sz, len + 1, diff + 1, curr->next[i]);
    }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  root = new node();
  int num_word, q;
  cin >> num_word >> q;
  for (int i = 0; i < num_word; i++) {
    cin >> strr;
    insert((int)strr.size());
  }
  for (int ia = 0; ia <= q - 1; ia++) {
    found = false;
    cin >> str;
    node* cur = root;
    search((int)str.size(), 0, 0, cur);
    if (found)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
