#include <bits/stdc++.h>
using namespace std;
template <class T1>
void deb(T1 e) {
  cout << e << '\n';
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << '\n';
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << '\n';
}
template <class T1, class T2, class T3, class T4>
void deb(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << '\n';
}
template <class T>
inline T gcd(T a, T b) {
  if (a < 0) return gcd(-a, b);
  if (b < 0) return gcd(a, -b);
  return (b == 0) ? a : gcd(b, a % b);
}
template <class T>
inline T lcm(T a, T b) {
  if (a < 0) return lcm(-a, b);
  if (b < 0) return lcm(a, -b);
  return a * (b / gcd(a, b));
}
ostream_iterator<int> screen(cout, " ");
const int sz = 2 * 1000 * 100 + 10, mod = 1000 * 1000 * 1000 + 7;
const int inf = INT_MAX >> 1;
const long long llinf = (1LL << 62);
const double pi = acos(-1.0);
int dx[] = {0, 0, 1, -1, 1, 1, -1, -1}, dy[] = {1, -1, 0, 0, 1, -1, 1, -1};
vector<int> res;
long long powermod(long long n, long long p) {
  long long x = 1, y = n % mod;
  while (p) {
    if (p & 1LL) x = (y * x) % mod;
    y = (y * y) % mod;
    p = p >> 1LL;
  }
  return x;
}
class node {
 public:
  vector<int> arr;
  node() { arr.resize(4, -1); }
};
vector<node> tr;
string s;
void builtTry(int pos, int id) {
  if (pos == s.size()) return;
  if (tr[id].arr[s[pos] - 'a'] == -1) {
    tr[id].arr[s[pos] - 'a'] = tr.size();
    tr.push_back(node());
    builtTry(pos + 1, (int)tr.size() - 1);
  } else
    builtTry(pos + 1, tr[id].arr[s[pos] - 'a']);
  return;
}
int findTry(int pos, int id, int flag) {
  if (pos == s.size()) return flag;
  for (int i = 0; i < tr[id].arr.size(); i++) {
    if (!flag and s[pos] != 'd') {
      if (tr[id].arr[i] != -1) {
        if (findTry(pos + 1, tr[id].arr[i], s[pos] - 'a' != i)) return 1;
      }
    } else {
      if (tr[id].arr[i] != -1 and s[pos] - 'a' == i)
        if (findTry(pos + 1, tr[id].arr[i], flag)) return 1;
    }
  }
  return 0;
}
int main() {
  int n, m;
  cin >> n >> m;
  tr.push_back(node());
  for (int i = 0; i < n; i++) {
    cin >> s;
    s = s + "d";
    builtTry(0, 0);
  }
  for (int i = 0; i < m; i++) {
    cin >> s;
    s = s + "d";
    if (findTry(0, 0, 0))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
