#include <bits/stdc++.h>
using namespace std;
using ll = long long;
uint64_t getSeed() {
  auto ptr = new char;
  delete ptr;
  return (uint64_t)ptr +
         chrono::high_resolution_clock::now().time_since_epoch().count();
}
mt19937 rnd(getSeed());
ll rndVal(uint64_t a, uint64_t b) {
  return uniform_int_distribution<uint64_t>(a, b)(rnd);
}
constexpr uint64_t MOD = (1ull << 61) - 1;
inline uint64_t mod(uint64_t x) {
  x++;
  x = (x & MOD) + (x >> 61);
  x = (x & MOD) + (x >> 61);
  return x - 1;
}
uint64_t mulmod(const uint64_t a, const uint64_t b) {
  uint64_t ha = a >> 32, la = uint32_t(a), hb = b >> 32, lb = uint32_t(b);
  uint64_t h = ha * hb, m = ha * lb + la * hb, l = la * lb;
  return mod((l & MOD) + (l >> 61) + (m >> 29) + (m << 35 >> 3) + (h << 3));
}
struct Hash {
  vector<uint64_t> h;
  vector<uint64_t> p;
  void build(const string& s, const uint64_t base) {
    int n = s.size();
    h.resize(n + 1);
    p.resize(n + 1);
    h[0] = 1;
    p[0] = 1;
    for (int i = 0; i < n; i++) {
      h[i + 1] = mod(mulmod(h[i], base) + s[i] + 130);
      p[i + 1] = mulmod(p[i], base);
    }
  }
  void build(const string& s) { build(s, rndVal(258, MOD - 1)); }
  uint64_t query(int l, int r) {
    return mod(h[r + 1] + MOD - mulmod(h[l], p[r - l + 1]));
  }
};
uint64_t bf(const string& s, int l, int r) {
  uint64_t h = 0;
  for (int i = l; i <= r; i++) {
    h = mod(mulmod(h, 12345) + s[i] + 130);
  }
  return h;
}
int main() {
  ios::sync_with_stdio(false);
  uint64_t base = rndVal(258, MOD - 1);
  Hash h;
  map<uint64_t, set<char>> have;
  int n, m;
  cin >> n >> m;
  for (int j = 0; j < n; j++) {
    string s;
    cin >> s;
    h.build(s, base);
    for (int i = 0; i < s.size(); i++) {
      uint64_t p = i ? h.query(0, i - 1) : 0;
      uint64_t sf = i + 1 < s.size() ? h.query(i + 1, s.size() - 1) : 0;
      uint64_t x = mod(mulmod(p, h.p[s.size() - i]) +
                       mulmod('*' + 130, h.p[s.size() - i - 1]) + sf);
      have[x].insert(s[i]);
    }
  }
  for (int j = 0; j < m; j++) {
    string s;
    cin >> s;
    h.build(s, base);
    bool ok = false;
    for (int i = 0; i < s.size() and not ok; i++) {
      uint64_t p = i ? h.query(0, i - 1) : 0;
      uint64_t sf = i + 1 < s.size() ? h.query(i + 1, s.size() - 1) : 0;
      uint64_t x = mod(mulmod(p, h.p[s.size() - i]) +
                       mulmod('*' + 130, h.p[s.size() - i - 1]) + sf);
      auto it = have.find(x);
      if (it == have.end()) continue;
      for (char c : it->second) {
        if (c != s[i]) {
          ok = true;
          break;
        }
      }
    }
    cout << (ok ? "YES\n" : "NO\n");
  }
}
