#include <bits/stdc++.h>
using namespace std;
bool chk(int n, int first) { return n & (1 << first); }
void set(int& n, int first) { n = n | (1 << first); }
void reset(int& n, int first) { n = n & ~(1 << first); }
const int mx = 600010;
bool f[mx];
int a[mx][3], _size;
char s[mx];
int new_node() {
  ++_size;
  for (int i = 0; i < 3; i++) a[_size][i] = 0;
  f[_size] = false;
  return _size;
}
void Insert(char str[]) {
  int cur = 0, i = -1;
  while (str[++i] != '\0') {
    int& next = a[cur][str[i] - 'a'];
    if (next == 0) next = new_node();
    cur = next;
  }
  f[cur] = true;
}
bool Search(int i, int cur, bool flag) {
  if (s[i] == '\0') return f[cur] && flag;
  if (flag) {
    int next = a[cur][s[i] - 'a'];
    if (next == 0) return false;
    return Search(i + 1, next, 1);
  } else {
    int next = a[cur][s[i] - 'a'];
    if (next > 0 && Search(i + 1, next, 0)) return true;
    for (int j = 0; j < 3; j++) {
      next = a[cur][j];
      if (next == 0) continue;
      if (s[i] == j + 'a') continue;
      if (Search(i + 1, next, 1)) return true;
    }
    return false;
  }
}
int main() {
  int i, j, k, n, m;
  while (scanf("%d%d", &n, &m) == 2) {
    _size = -1;
    new_node();
    for (i = 0; i < n; i++) {
      scanf("%s", s);
      Insert(s);
    }
    for (i = 0; i < m; i++) {
      scanf("%s", s);
      if (Search(0, 0, 0))
        printf("YES\n");
      else
        printf("NO\n");
    }
  }
}
