#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> operator*(int x, pair<long long, long long> b) {
  return make_pair(x * b.first, x * b.second % 1000000007);
}
pair<long long, long long> operator+(pair<long long, long long> a,
                                     pair<long long, long long> b) {
  a.first += b.first;
  a.second += b.second;
  if (a.second >= 1000000007) a.second -= 1000000007;
  if (a.second < 0) a.second += 1000000007;
  return a;
}
int n, m;
string str;
set<pair<long long, long long> > s[2 * 300010];
pair<long long, long long> p[2 * 300010];
pair<long long, long long> phash(string t) {
  pair<long long, long long> h = make_pair(0, 0);
  for (int i = 0; i < t.size(); i++) {
    int x = t[i] - 'a';
    h = h + x * p[i];
  }
  return h;
}
int main() {
  p[0] = make_pair(1, 1);
  for (int i = 1; i < 2 * 300010; i++) {
    p[i] = 17 * p[i - 1];
  }
  ios::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> str;
    pair<long long, long long> h = phash(str);
    s[str.size()].insert(h);
  }
  for (int i = 0; i < m; i++) {
    cin >> str;
    pair<long long, long long> h = phash(str);
    bool found = 0;
    for (int j = 0; j < str.size() && !found; j++) {
      int x = str[j] - 'a';
      int a = (x + 1) % 3;
      int b = (x + 2) % 3;
      h = h + -x * p[j];
      if (s[str.size()].count(h + a * p[j]))
        found = 1;
      else if (s[str.size()].count(h + b * p[j]))
        found = 1;
      h = h + x * p[j];
    }
    cout << (found ? "YES" : "NO") << '\n';
  }
}
