#include <bits/stdc++.h>
using namespace std;
unordered_set<long long> q;
long long p[601010];
int main() {
  long long M = 100000000000000003L;
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  p[0] = 1;
  for (int i = 1; i < 601010; ++i) p[i] = p[i - 1] * 3 % M;
  int n, m;
  cin >> n >> m;
  string s, s2;
  for (int i = 0; i < n; ++i) {
    cin >> s;
    long long v = 0;
    for (int j = 0; j < s.size(); ++j) v = (v * 3 + s[j] - 96) % M;
    q.insert(v);
  }
  for (int i = 0; i < m; ++i) {
    cin >> s;
    long long v = 0;
    for (int j = 0; j < s.size(); ++j) v = (v * 3 + s[j] - 96) % M;
    bool t = false;
    for (int j = 0; j < s.size(); ++j) {
      long long r = (v - (s[j] - 96) * p[s.size() - j - 1]) % M;
      if (r < 0) r += M;
      if (s[j] != 'a')
        if (q.count((r + ('a' - 96) * p[s.size() - j - 1]) % M)) t = true;
      if (s[j] != 'b')
        if (q.count((r + ('b' - 96) * p[s.size() - j - 1]) % M)) t = true;
      if (s[j] != 'c')
        if (q.count((r + ('c' - 96) * p[s.size() - j - 1]) % M)) t = true;
      if (t) break;
    }
    if (t)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
