#include <bits/stdc++.h>
using namespace std;
int n, m;
long long p = 655360;
long long mod = 123456789341;
long long pows[700005];
set<long long> st;
string x, y;
int main() {
  pows[0] = 1;
  for (int i = 1; i < 700005; i++) {
    pows[i] = pows[i - 1] * p;
    pows[i] %= mod;
  }
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> x;
    long long hs = 0;
    for (int i = 0; i < x.size(); i++) {
      hs += (x[i] - 'a' + 7) * pows[i];
      hs += mod;
      hs %= mod;
    }
    for (int i = 0; i < x.size(); i++) {
      for (int j = 0; j < 3; j++) {
        char cur = (char)('a' + j);
        if (cur != x[i]) {
          hs -= (x[i] - 'a' + 7) * pows[i];
          hs += mod;
          hs %= mod;
          hs += (cur - 'a' + 7) * pows[i];
          hs += mod;
          hs %= mod;
          st.insert(hs);
          hs += (x[i] - 'a' + 7) * pows[i];
          hs += mod;
          hs %= mod;
          hs -= (cur - 'a' + 7) * pows[i];
          hs += mod;
          hs %= mod;
        }
      }
    }
  }
  for (int i = 0; i < m; i++) {
    cin >> y;
    long long hs = 0;
    for (int pos = 0; pos < y.size(); pos++) {
      hs += (y[pos] - 'a' + 7) * pows[pos];
      hs += mod;
      hs %= mod;
    }
    if (st.count(hs))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
