#include <bits/stdc++.h>
using namespace std;
const int maxn = 600005;
const pair<long long, long long> mod = make_pair(1e9 + 7, 1e9 + 9);
const int base = 347;
pair<long long, long long> operator*(pair<long long, long long> a,
                                     long long b) {
  return make_pair(a.first * b, a.second * b);
}
pair<long long, long long> operator+(pair<long long, long long> a,
                                     long long b) {
  return make_pair(a.first + b, a.second + b);
}
pair<long long, long long> operator-(pair<long long, long long> a,
                                     long long b) {
  return make_pair(a.first - b, a.second - b);
}
pair<long long, long long> operator%(pair<long long, long long> a,
                                     pair<long long, long long> b) {
  return make_pair(a.first % b.first, a.second % b.second);
}
pair<long long, long long> operator+(pair<long long, long long> a,
                                     pair<long long, long long> b) {
  return make_pair(a.first + b.first, a.second + b.second);
}
char s[maxn];
int len;
set<pair<long long, long long> > values;
pair<long long, long long> power[maxn];
pair<long long, long long> Hash() {
  pair<long long, long long> ret = make_pair(0, 0);
  for (int i = 0; i < len; i++) {
    ret = (ret * base + s[i]) % mod;
  }
  return ret;
}
bool query() {
  pair<long long, long long> pre = Hash();
  for (long long i = 0; i < len; i++) {
    for (long long j = 'a'; j <= 'c'; j++) {
      if (j == s[i]) continue;
      pair<long long, long long> now = pre;
      now = (now + power[len - i - 1] * (j - s[i])) % mod;
      now = (now + mod) % mod;
      if (values.count(now)) return true;
    }
  }
  return false;
}
int main() {
  power[0] = make_pair(1, 1);
  for (long long i = 1; i < maxn; i++) {
    power[i] = (power[i - 1] * base) % mod;
  }
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%s", s);
    len = strlen(s);
    values.insert(Hash());
  }
  for (int i = 0; i < m; i++) {
    scanf("%s", s);
    len = strlen(s);
    bool ans = query();
    if (ans)
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
