#include <bits/stdc++.h>
using namespace std;
struct Trie {
  Trie() : a(nullptr), b(nullptr), c(nullptr) {}
  Trie* a;
  Trie* b;
  Trie* c;
};
struct Queue {
  Queue(Trie* t, int pos, int diff) {
    this->t = t;
    this->pos = pos;
    this->diff = diff;
  }
  Trie* t;
  int pos;
  int diff;
};
Trie t;
void insert(const string& s) {
  int pos = 0;
  Trie* n = &t;
  while (pos < s.size()) {
    Trie** nn;
    switch (s[pos]) {
      case 'a':
        nn = &n->a;
        break;
      case 'b':
        nn = &n->b;
        break;
      case 'c':
        nn = &n->c;
        break;
    }
    if (*nn == nullptr) {
      *nn = new Trie();
    }
    n = *nn;
    pos++;
  }
}
bool search(const string& s) {
  queue<Queue> q;
  q.push(Queue(&t, 0, 0));
  while (!q.empty()) {
    const Queue& qu = q.front();
    q.pop();
    if (qu.pos == s.size()) {
      if (qu.diff == 1) {
        return true;
      } else {
        continue;
      }
    }
    if (qu.diff == 0) {
      if (qu.t->a != nullptr && s[qu.pos] != 'a') {
        q.push(Queue(qu.t->a, qu.pos + 1, 1));
      }
      if (qu.t->b != nullptr && s[qu.pos] != 'b') {
        q.push(Queue(qu.t->b, qu.pos + 1, 1));
      }
      if (qu.t->c != nullptr && s[qu.pos] != 'c') {
        q.push(Queue(qu.t->c, qu.pos + 1, 1));
      }
    }
    Trie* nn;
    switch (s[qu.pos]) {
      case 'a':
        nn = qu.t->a;
        break;
      case 'b':
        nn = qu.t->b;
        break;
      case 'c':
        nn = qu.t->c;
        break;
    }
    if (nn != nullptr) {
      q.push(Queue(nn, qu.pos + 1, qu.diff));
    }
  }
  return false;
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    insert(s);
  }
  for (int i = 0; i < m; ++i) {
    string m;
    cin >> m;
    cout << (search(m) ? "YES" : "NO") << "\n";
  }
  return 0;
}
