#include <bits/stdc++.h>
using namespace std;
const int maxx = 2000010;
const double pi = acos(-1.0);
const double eps = 1e-15;
map<pair<long long, long long>, long long> h, mk;
map<pair<long long, pair<long long, long long> >, long long> hh;
int t, n, m, k;
long long ans = 0, total = 0, sum = 0, cnt = 0, pos = 0, s1 = 0, s2 = 0, a1 = 0,
          a2 = 0;
long long a[maxx], vis[maxx];
char c[maxx], ch[maxx];
struct nod {
  long long v1, v2;
} kl[maxx];
struct node {
  int num;
  long long val1, val2;
} b[maxx];
bool cmp(node a, node b) {
  if (a.val1 == b.val1) return a.val2 < b.val2;
  return a.val1 < b.val1;
}
int main() {
  scanf("%d%d", &n, &k);
  n = n * k;
  scanf(" %s", c + 1);
  for (int i = n + 1; i <= 2 * n; i++) c[i] = c[i - n];
  scanf("%d", &m);
  a1 = a2 = 1;
  for (int i = 1; i < k; i++)
    a1 = a1 * 237 % 998244353, a2 = a2 * 237 % 1000000007;
  for (int i = 1; i <= m; i++) {
    scanf(" %s", ch + 1);
    s1 = s2 = 0;
    for (int j = 1; j <= k; j++)
      s1 = (s1 * 237 % 998244353 + ch[j] - 'a' + 1) % 998244353,
      s2 = (s2 * 237 % 1000000007 + ch[j] - 'a' + 1) % 1000000007;
    h[make_pair(s1, s2)]++, b[i].val1 = s1, b[i].val2 = s2, b[i].num = i;
  }
  sort(b + 1, b + n + 1, cmp);
  for (int i = 1; i <= n; i++) {
    mk[make_pair(b[i].val1, b[i].val2)] = i;
    for (int j = i; j <= n; j++) {
      if (b[i].val1 != b[j].val1 || b[i].val2 != b[j].val2) {
        i = j - 1;
        break;
      }
      if (j == n) i = n + 1;
    }
  }
  s1 = s2 = 0;
  for (int i = 1; i <= k; i++)
    s1 = (s1 * 237 % 998244353 + c[i] - 'a' + 1) % 998244353,
    s2 = (s2 * 237 % 1000000007 + c[i] - 'a' + 1) % 1000000007;
  kl[1].v1 = s1, kl[1].v2 = s2;
  for (int i = k + 1; i <= 2 * n; i++) {
    s1 = (s1 - a1 * (c[i - k] - 'a' + 1) % 998244353 + 998244353) % 998244353,
    s1 = (s1 * 237 % 998244353 + c[i] - 'a' + 1) % 998244353;
    s2 =
        (s2 - a2 * (c[i - k] - 'a' + 1) % 1000000007 + 1000000007) % 1000000007,
    s2 = (s2 * 237 % 1000000007 + c[i] - 'a' + 1) % 1000000007;
    kl[i - k + 1].v1 = s1, kl[i - k + 1].v2 = s2;
  }
  for (int i = 1; i <= n; i++) {
    int u = i % k;
    if (vis[u]) continue;
    hh[make_pair(u, make_pair(kl[i].v1, kl[i].v2))]++;
    if (hh[make_pair(u, make_pair(kl[i].v1, kl[i].v2))] >
            h[make_pair(kl[i].v1, kl[i].v2)] ||
        !h.count(make_pair(kl[i].v1, kl[i].v2)))
      vis[u] = 1;
  }
  pos = -1;
  for (int i = 0; i < k; i++)
    if (!vis[i]) {
      pos = i;
      break;
    }
  if (pos == -1)
    printf("NO");
  else {
    printf("YES\n");
    if (!pos) pos = k;
    for (int i = pos; i <= n; i += k)
      printf("%d ", b[mk[make_pair(kl[i].v1, kl[i].v2)]++].num);
  }
  return 0;
}
