#include <bits/stdc++.h>
using namespace std;
const int maxn = 3;
struct node {
  node *next[maxn];
  int id;
  node() {
    for (int i = 0; i < maxn; i++) next[i] = NULL;
    id = 0;
  }
};
node *head;
void tinsert(char *str) {
  node *t, *s = head;
  for (int i = 0; str[i]; i++) {
    int id = str[i] - 'a';
    if (s->next[id] == NULL) {
      t = new node;
      s->next[id] = t;
      s->id = 1;
    }
    s = s->next[id];
  }
}
bool tfind(char *str, bool help, node *s) {
  if (s == NULL) return false;
  if (!*str) {
    if (s->id == 0)
      return help;
    else
      return false;
  }
  if (s->id == 0) return false;
  int id = *str - 'a';
  if (help) {
    if (s->next[id] == NULL) return false;
  }
  if (s->next[id] != NULL)
    if (tfind(str + 1, help, s->next[id])) return true;
  if (!help) {
    for (int j = 0; j < maxn; j++) {
      if (j != id) {
        if (tfind(str + 1, true, s->next[j])) return true;
      }
    }
  }
  return false;
}
int main() {
  head = new node;
  int n, m;
  scanf("%d %d", &n, &m);
  char s[600005];
  for (int i = 0; i < n; i++) {
    scanf("%s", s);
    tinsert(s);
  }
  for (int i = 0; i < m; i++) {
    scanf("%s", s);
    if (tfind(s, false, head))
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
