#include <bits/stdc++.h>
using namespace std;
map<long long, bool> ch;
const long long mod = 1110111110111;
int main() {
  int n, m;
  cin >> n >> m;
  while (n--) {
    long long a = 0, d = 1;
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
      a = (a + (s[i] - 'a' + 1) * d);
      a %= mod;
      d *= 5;
      d %= mod;
    }
    ch[a] = 1;
  }
  while (m--) {
    long long a = 0, d = 1;
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
      a += (long long)(s[i] - 'a' + 1) * d;
      a %= mod;
      d *= 5;
      d %= mod;
    }
    d = 1;
    bool dis = 0;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] != 'a') {
        if (ch[(a - (s[i] - 'a') * d + 4 * mod) % mod]) {
          dis = 1;
          break;
        }
      }
      if (s[i] != 'b') {
        if (ch[(a - (s[i] - 'a' - 1) * d + 4 * mod) % mod]) {
          dis = 1;
          break;
        }
      }
      if (s[i] != 'c') {
        if (ch[(a - (s[i] - 'a' - 2) * d + 4 * mod) % mod]) {
          dis = 1;
          break;
        }
      }
      d *= 5;
      d %= mod;
    }
    if (dis)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
