#include <bits/stdc++.h>
using namespace std;
void base() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
long long mod = 1e9 + 9;
long long pp = 31, pp2 = 37;
long long res[2000020], res2[2000020];
long long p[2000020], p2[2000020];
long long inv[2000020], inv2[2000020];
unordered_map<long long, int> mmap;
long long fexpo(long long a, long long n) {
  if (n == 0) return 1;
  long long x = fexpo(a, n / 2);
  x = (x * x) % mod;
  if (n & 1) x = (x * a % mod);
  return x;
}
long long invmod(long long n) { return fexpo(n, mod - 2); }
void solve() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  s += s;
  p[0] = p2[0] = 1;
  inv[0] = invmod(p[0]);
  inv2[0] = invmod(p2[0]);
  for (int i = 1; i < s.size() + 1; ++i) {
    p[i] = (p[i - 1] * pp) % mod;
    p2[i] = (p2[i - 1] * pp2) % mod;
    inv[i] = invmod(p[i]);
    inv2[i] = invmod(p2[i]);
    res[i] = (res[i - 1] + p[i] * (s[i - 1] - 'a' + 1)) % mod;
    res2[i] = (res2[i - 1] + p2[i] * (s[i - 1] - 'a' + 1)) % mod;
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; ++i) {
    string ss;
    cin >> ss;
    long long h = 0;
    long long h2 = 0;
    for (int i = 1; i < ss.size() + 1; ++i) {
      h = (h + p[i] * (ss[i - 1] - 'a' + 1)) % mod;
      h2 = (h2 + p2[i] * (ss[i - 1] - 'a' + 1)) % mod;
    }
    long long nh = h * mod + h2;
    mmap[nh] = i + 1;
  }
  for (int i = 0; i < k; ++i) {
    vector<int> ans;
    bool used[100020] = {0};
    for (int j = 1; j < n + 1; ++j) {
      long long hh = ((res[j * k + i] - res[j * k + i - k] + mod) % mod *
                      inv[j * k + i - k]) %
                     mod;
      long long hh2 = ((res2[j * k + i] - res2[j * k + i - k] + mod) % mod *
                       inv2[j * k + i - k]) %
                      mod;
      long long nhh = hh * mod + hh2;
      if (mmap.find(nhh) == mmap.end()) break;
      int id = mmap[nhh];
      if (used[id]) break;
      used[id] = 1;
      ans.push_back(id);
    }
    if (ans.size() == n) {
      cout << "YES\n";
      for (int x : ans) cout << x << " ";
      cout << "\n";
      return;
    }
  }
  cout << "NO\n";
}
int main() {
  base();
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
