#include <bits/stdc++.h>
using namespace std;
const int N = 1800001;
int trie[3][N];
bool flag[N];
int front = 1;
void insertTrie(const string &s) {
  int idx = 0;
  for (int i = 0; i < s.size(); i++) {
    int c = s[i] - 'a';
    if (!trie[c][idx]) {
      trie[c][idx] = front++;
    }
    idx = trie[c][idx];
  }
  flag[idx] = true;
}
bool solve(int idx, int f, int tIdx, const string &s) {
  if (idx == s.size()) {
    if (!f) return false;
    return flag[tIdx];
  }
  int c = s[idx] - 'a';
  bool res = false;
  if (trie[c][tIdx]) res |= solve(idx + 1, f, trie[c][tIdx], s);
  if (!f && !res) {
    for (int i = 0; i < 3; i++)
      if (i != c && trie[i][tIdx]) {
        res |= solve(idx + 1, 1, trie[i][tIdx], s);
      }
  }
  return res;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    insertTrie(s);
  }
  for (int i = 0; i < m; i++) {
    string s;
    cin >> s;
    if (solve(0, 0, 0, s)) {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
  }
  return 0;
}
