#include <bits/stdc++.h>
using namespace std;
vector<string> s1, s2, s3[300006];
set<string> ss[300006];
vector<unsigned long long> score[400000];
int main() {
  long long n, m;
  cin >> n >> m;
  for (long long i = 0; i < n; i++) {
    string t;
    cin >> t;
    ss[t.size()].insert(t);
    s3[t.size()].push_back(t);
  }
  for (long long i = 0; i < m; i++) {
    string t;
    cin >> t;
    s2.push_back(t);
  }
  for (long long i = 0; i < m; i++) {
    bool flg = false;
    if (s2[i].size() <= 300) {
      for (long long j = 0; j < s2[i].size(); j++) {
        char pre;
        pre = s2[i][j];
        for (int k = 0; k < 3; k++) {
          if (k + 'a' == pre) {
            continue;
          }
          s2[i][j] = k + 'a';
          if (ss[s2[i].size()].count(s2[i]) >= 1) {
            flg = true;
          }
          s2[i][j] = pre;
        }
      }
    } else if (300000 >= s2[i].size()) {
      long long si, count;
      si = s2[i].size();
      bool flg1;
      for (long long j = 0; j < s3[si].size(); j++) {
        flg1 = false;
        count = 0;
        for (long long k = 0; k < s3[si][j].size(); k++) {
          if (s2[i][k] != s3[si][j][k]) count++;
          if (count > 1) {
            flg1 = true;
            break;
          }
        }
        if (flg1 == false && count == 1) flg = true;
      }
    }
    if (flg) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
