#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long MM = 1e15 + 37;
long long power(long long a, long long b, long long m = mod) {
  long long ans = 1;
  a = a % m;
  while (b > 0) {
    if (b & 1) ans = (1ll * a * ans) % m;
    b >>= 1;
    a = (1ll * a * a) % m;
  }
  return ans;
}
const long long N = 300050;
long long A[N];
struct node {
  node *next[3];
  bool end;
  node() {
    memset(next, 0, sizeof next);
    end = 0;
  }
};
struct Trie {
  node *root;
  Trie() { root = new node; }
  void insert(const string &s) {
    node *cur = root;
    for (char ch : s) {
      if (!(cur->next[ch - 'a'])) cur->next[ch - 'a'] = new node;
      cur = cur->next[ch - 'a'];
    }
    cur->end = true;
  }
  bool find(const string &s, node *cur, long long mismatch = 1,
            long long i = 0) {
    if (cur == NULL) return false;
    if (i == s.size()) return mismatch == 0 && cur->end;
    bool ans = find(s, cur->next[s[i] - 'a'], mismatch, i + 1);
    if (mismatch > 0) {
      for (long long j = 0; j < 3 && !ans; j++) {
        if (j == s[i] - 'a') continue;
        ans = find(s, cur->next[j], mismatch - 1, i + 1);
      }
    }
    return ans;
  }
};
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long t = 1;
  while (t--) {
    Trie T;
    long long n, m;
    string s;
    cin >> n >> m;
    for (long long i = 0; i < n; i++) {
      cin >> s;
      T.insert(s);
    }
    for (long long i = 0; i < m; i++) {
      cin >> s;
      cout << (T.find(s, T.root) ? "YES\n" : "NO\n");
    }
  }
  return 0;
}
