#include <bits/stdc++.h>
using namespace std;
typedef struct no {
  no *next[3];
  int tem;
} no;
string str;
void insert(no *v, int pos) {
  if (pos == str.size()) {
    v->tem = 1;
    return;
  }
  if (v->next[str[pos] - 'a'] == NULL) {
    v->next[str[pos] - 'a'] = new no();
    for (int i = 0; i < 3; i++) {
      v->next[str[pos] - 'a']->next[i] = NULL;
    }
    v->next[str[pos] - 'a']->tem = 0;
  }
  insert(v->next[str[pos] - 'a'], pos + 1);
}
int query(no *v, int pos, int dif) {
  if (dif > 1) return 0;
  if (pos == str.size()) {
    return dif;
  }
  int x = 0;
  if (str[pos] == 'a') {
    if (v->next[1] != NULL) {
      x += query(v->next[1], pos + 1, dif + 1);
    }
    if (v->next[2] != NULL) {
      x += query(v->next[2], pos + 1, dif + 1);
    }
    if (v->next[str[pos] - 'a'] != NULL)
      x += query(v->next[str[pos] - 'a'], pos + 1, dif);
  } else if (str[pos] == 'b') {
    if (v->next[0] != NULL) {
      x += query(v->next[0], pos + 1, dif + 1);
    }
    if (v->next[2] != NULL) {
      x += query(v->next[2], pos + 1, dif + 1);
    }
    if (v->next[str[pos] - 'a'] != NULL)
      x += query(v->next[str[pos] - 'a'], pos + 1, dif);
  } else {
    if (v->next[1] != NULL) {
      x += query(v->next[1], pos + 1, dif + 1);
    }
    if (v->next[0] != NULL) {
      x += query(v->next[0], pos + 1, dif + 1);
    }
    if (v->next[str[pos] - 'a'] != NULL)
      x += query(v->next[str[pos] - 'a'], pos + 1, dif);
  }
  return x;
}
int main() {
  ios ::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  no *raiz = new no();
  for (int i = 0; i < 3; i++) raiz->next[i] = NULL;
  for (int i = 0; i < n; i++) {
    cin >> str;
    insert(raiz, 0);
  }
  for (int i = 0; i < m; i++) {
    cin >> str;
    if (query(raiz, 0, 0))
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
