#include <bits/stdc++.h>
using namespace std;
struct trie {
  trie* a[3];
  bool isend;
} * head;
void init() {
  head = new trie();
  int i;
  for (i = 0; i < 3; i++) head->a[i] = NULL;
}
bool found;
string s;
void build(string s1) {
  int i, len;
  len = s1.length();
  trie* temp = head;
  for (i = 0; i < len; i++) {
    if (temp->a[s1[i] - 'a'] == NULL) {
      temp->a[s1[i] - 'a'] = new trie();
      temp = temp->a[s1[i] - 'a'];
      temp->isend = false;
      temp->a[0] = temp->a[1] = temp->a[2] = NULL;
    } else {
      temp = temp->a[s1[i] - 'a'];
    }
    if (i == len - 1) {
      temp->isend = true;
    }
  }
}
void dfs(trie* temp = head, int pos = 0, int diff = 0) {
  int i;
  if (pos == s.length() && diff && temp->isend) {
    found = true;
    return;
  }
  if (pos == s.length()) return;
  if (diff) {
    if (temp->a[s[pos] - 'a'] != NULL)
      dfs(temp->a[s[pos] - 'a'], pos + 1, diff);
  } else {
    for (i = 0; i < 3; i++) {
      if (s[pos] - 'a' == i) {
        if (temp->a[s[pos] - 'a'] != NULL)
          dfs(temp->a[s[pos] - 'a'], pos + 1, diff);
      } else {
        if (temp->a[i] != NULL) dfs(temp->a[i], pos + 1, 1);
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  init();
  int n, m, i, j;
  char c;
  cin >> n >> m;
  string s1;
  for (i = 1; i <= n; i++) {
    cin >> s1;
    build(s1);
  }
  for (i = 1; i <= m; i++) {
    cin >> s;
    found = false;
    dfs();
    if (found) {
      cout << "YES\n";
    } else {
      cout << "NO\n";
    }
  }
  return 0;
}
