#include <bits/stdc++.h>
using namespace std;
struct node {
  node *c[3];
  bool flag;
};
node *root;
void insert(string a) {
  node *cur = root;
  for (int i = 0; i < a.size(); i++) {
    if (!(cur->c[a[i] - 'a'])) cur->c[a[i] - 'a'] = new node();
    cur = cur->c[a[i] - 'a'];
  }
  cur->flag = 1;
}
string s;
bool solve(node *root, int pos, int diff) {
  if (!root) return 0;
  if (diff > 1) return 0;
  if (pos == s.size()) return diff == 1 && root->flag;
  int ret = 0;
  for (int i = 0; i < 3; i++)
    ret = ret || solve(root->c[i], pos + 1, (s[pos] - 'a' != i) + diff);
  return ret;
}
int main() {
  int n, m;
  cin >> n >> m;
  root = new node();
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    insert(s);
  }
  for (int i = 0; i < m; i++) {
    cin >> s;
    if (solve(root, 0, 0))
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
