#include <bits/stdc++.h>
using namespace std;
const int CNT = 2;
const int MAX_L = 2 * 1000 * 1000;
const long long X[CNT] = {5, 7};
const long long P[CNT] = {35317, 112909};
char s[MAX_L];
long long h[CNT];
long long xx[CNT];
set<pair<long long, long long>> T;
long long getV(char ch) { return (ch - 'a' + 1); }
void calcHashes() {
  int l = strlen(s);
  for (int i = 0; i < CNT; i++) h[i] = 0;
  for (int i = 0; i < l; i++) {
    long long v = getV(s[i]);
    h[0] = ((h[0] * X[0]) % P[0] + v) % P[0];
    h[1] = ((h[1] * X[1]) % P[1] + v) % P[1];
  }
}
void change(const pair<long long, long long> &t1, char a, char b,
            pair<long long, long long> &t2) {
  long long z[2];
  for (int i = 0; i < CNT; i++) {
    long long aa = (getV(a) * xx[i]) % P[i];
    long long bb = (getV(b) * xx[i]) % P[i];
    z[i] = (((i ? t1.second : t1.first) - aa) % P[i] + P[i]) % P[i];
    z[i] = (z[i] + bb) % P[i];
  }
  t2 = {z[0], z[1]};
}
int main() {
  int N, M;
  scanf("%d%d", &N, &M);
  pair<long long, long long> temp, t;
  for (int i = 0; i < N; i++) {
    scanf("%s", &s);
    calcHashes();
    temp = {h[0], h[1]};
    T.insert(temp);
  }
  for (int i = 0; i < M; i++) {
    scanf("%s", &s);
    calcHashes();
    xx[0] = xx[1] = 1;
    temp = {h[0], h[1]};
    int l = strlen(s);
    bool answer = false;
    for (int j = l - 1; j >= 0 && !answer; j--) {
      for (char c = 'a'; c <= 'c'; c++)
        if (s[j] != c) {
          change(temp, s[j], c, t);
          if (T.find(t) != T.end()) {
            answer = true;
          }
        }
      for (int k = 0; k < CNT; k++) xx[k] = (xx[k] * X[k]) % P[k];
    }
    if (answer)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
