#include <bits/stdc++.h>
using namespace std;
int n, m;
char s[600005];
map<long long, int> h;
int main() {
  scanf("%d %d", &n, &m);
  for (int i = (0); i < (n); i++) {
    scanf("%s", s);
    long long x = 0;
    for (int j = 0; s[j]; j++) x = (x * 4 + s[j] - 'a' + 1) % 1000000000007LL;
    h[x] = 1;
  }
  for (int i = (0); i < (m); i++) {
    scanf("%s", s);
    int j = 0;
    long long x = 0, b = 1;
    for (; s[j]; j++) x = (x * 4 + s[j] - 'a' + 1) % 1000000000007LL;
    bool ok = 0;
    for (j--; j >= 0; j--) {
      s[j] -= 'a' - 1;
      long long t = ((x - b * s[j]) % 1000000000007LL + 1000000000007LL) %
                    1000000000007LL;
      for (int k = (1); k < (4); k++)
        if (k != s[j] && h[(t + b * k) % 1000000000007LL]) ok = 1;
      b = (b * 4) % 1000000000007LL;
      if (ok) break;
    }
    puts(ok ? "YES" : "NO");
  }
}
