#include <bits/stdc++.h>
using namespace std;
const int N = 5e6 + 5, M = 1e7 + 5, K = 25;
unsigned char mask[] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
void getBuckets(unsigned char *s, int *bkt, int n, int K, int cs, bool end) {
  int i, sum = 0;
  for (i = 0; i <= K; i++) bkt[i] = 0;
  for (i = 0; i < n; i++)
    bkt[(cs == sizeof(int) ? ((int *)s)[i] : ((unsigned char *)s)[i])]++;
  for (i = 0; i <= K; i++) {
    sum += bkt[i];
    bkt[i] = end ? sum : sum - bkt[i];
  }
}
void induceSAl(unsigned char *t, int *SA, unsigned char *s, int *bkt, int n,
               int K, int cs, bool end) {
  int i, j;
  getBuckets(s, bkt, n, K, cs, end);
  for (i = 0; i < n; i++) {
    j = SA[i] - 1;
    if (j >= 0 && !((t[(j) / 8] & mask[(j) % 8]) ? 1 : 0))
      SA[bkt[(cs == sizeof(int) ? ((int *)s)[j] : ((unsigned char *)s)[j])]++] =
          j;
  }
}
void induceSAs(unsigned char *t, int *SA, unsigned char *s, int *bkt, int n,
               int K, int cs, bool end) {
  int i, j;
  getBuckets(s, bkt, n, K, cs, end);
  for (i = n - 1; i >= 0; i--) {
    j = SA[i] - 1;
    if (j >= 0 && ((t[(j) / 8] & mask[(j) % 8]) ? 1 : 0))
      SA[--bkt[(cs == sizeof(int) ? ((int *)s)[j] : ((unsigned char *)s)[j])]] =
          j;
  }
}
void SA_IS(unsigned char *s, int *SA, int n, int K, int cs) {
  int i, j;
  unsigned char *t = (unsigned char *)malloc(n / 8 + 1);
  t[(n - 2) / 8] = (0) ? (mask[(n - 2) % 8] | t[(n - 2) / 8])
                       : ((~mask[(n - 2) % 8]) & t[(n - 2) / 8]);
  t[(n - 1) / 8] = (1) ? (mask[(n - 1) % 8] | t[(n - 1) / 8])
                       : ((~mask[(n - 1) % 8]) & t[(n - 1) / 8]);
  for (i = n - 3; i >= 0; i--)
    t[(i) / 8] =
        (((cs == sizeof(int) ? ((int *)s)[i] : ((unsigned char *)s)[i]) <
              (cs == sizeof(int) ? ((int *)s)[i + 1]
                                 : ((unsigned char *)s)[i + 1]) ||
          ((cs == sizeof(int) ? ((int *)s)[i] : ((unsigned char *)s)[i]) ==
               (cs == sizeof(int) ? ((int *)s)[i + 1]
                                  : ((unsigned char *)s)[i + 1]) &&
           ((t[(i + 1) / 8] & mask[(i + 1) % 8]) ? 1 : 0) == 1))
             ? 1
             : 0)
            ? (mask[(i) % 8] | t[(i) / 8])
            : ((~mask[(i) % 8]) & t[(i) / 8]);
  int *bkt = (int *)malloc(sizeof(int) * (K + 1));
  getBuckets(s, bkt, n, K, cs, true);
  for (i = 0; i < n; i++) SA[i] = -1;
  for (i = 1; i < n; i++)
    if ((i > 0 && ((t[(i) / 8] & mask[(i) % 8]) ? 1 : 0) &&
         !((t[(i - 1) / 8] & mask[(i - 1) % 8]) ? 1 : 0)))
      SA[--bkt[(cs == sizeof(int) ? ((int *)s)[i] : ((unsigned char *)s)[i])]] =
          i;
  induceSAl(t, SA, s, bkt, n, K, cs, false);
  induceSAs(t, SA, s, bkt, n, K, cs, true);
  free(bkt);
  int n1 = 0;
  for (i = 0; i < n; i++)
    if ((SA[i] > 0 && ((t[(SA[i]) / 8] & mask[(SA[i]) % 8]) ? 1 : 0) &&
         !((t[(SA[i] - 1) / 8] & mask[(SA[i] - 1) % 8]) ? 1 : 0)))
      SA[n1++] = SA[i];
  for (i = n1; i < n; i++) SA[i] = -1;
  int name = 0, prev = -1;
  for (i = 0; i < n1; i++) {
    int pos = SA[i];
    bool diff = false;
    for (int d = 0; d < n; d++)
      if (prev == -1 ||
          (cs == sizeof(int) ? ((int *)s)[pos + d]
                             : ((unsigned char *)s)[pos + d]) !=
              (cs == sizeof(int) ? ((int *)s)[prev + d]
                                 : ((unsigned char *)s)[prev + d]) ||
          ((t[(pos + d) / 8] & mask[(pos + d) % 8]) ? 1 : 0) !=
              ((t[(prev + d) / 8] & mask[(prev + d) % 8]) ? 1 : 0)) {
        diff = true;
        break;
      } else if (d > 0 &&
                 ((pos + d > 0 &&
                   ((t[(pos + d) / 8] & mask[(pos + d) % 8]) ? 1 : 0) &&
                   !((t[(pos + d - 1) / 8] & mask[(pos + d - 1) % 8]) ? 1
                                                                      : 0)) ||
                  (prev + d > 0 &&
                   ((t[(prev + d) / 8] & mask[(prev + d) % 8]) ? 1 : 0) &&
                   !((t[(prev + d - 1) / 8] & mask[(prev + d - 1) % 8]) ? 1
                                                                        : 0))))
        break;
    if (diff) {
      name++;
      prev = pos;
    }
    pos = (pos % 2 == 0) ? pos / 2 : (pos - 1) / 2;
    SA[n1 + pos] = name - 1;
  }
  for (i = n - 1, j = n - 1; i >= n1; i--)
    if (SA[i] >= 0) SA[j--] = SA[i];
  int *SA1 = SA, *s1 = SA + n - n1;
  if (name < n1)
    SA_IS((unsigned char *)s1, SA1, n1, name - 1, sizeof(int));
  else
    for (i = 0; i < n1; i++) SA1[s1[i]] = i;
  bkt = (int *)malloc(sizeof(int) * (K + 1));
  getBuckets(s, bkt, n, K, cs, true);
  for (i = 1, j = 0; i < n; i++)
    if ((i > 0 && ((t[(i) / 8] & mask[(i) % 8]) ? 1 : 0) &&
         !((t[(i - 1) / 8] & mask[(i - 1) % 8]) ? 1 : 0)))
      s1[j++] = i;
  for (i = 0; i < n1; i++) SA1[i] = s1[SA1[i]];
  for (i = n1; i < n; i++) SA[i] = -1;
  for (i = n1 - 1; i >= 0; i--) {
    j = SA[i];
    SA[i] = -1;
    SA[--bkt[(cs == sizeof(int) ? ((int *)s)[j] : ((unsigned char *)s)[j])]] =
        j;
  }
  induceSAl(t, SA, s, bkt, n, K, cs, false);
  induceSAs(t, SA, s, bkt, n, K, cs, true);
  free(bkt);
  free(t);
}
const int maxn = M;
int sa[N];
int lcp[N];
int rankk[N];
unsigned char *s;
int n, m;
void calc_lcp() {
  int k = 0;
  for (int i = 0; i < m; i++) {
    while (s[i + k] == s[sa[rankk[i] - 1] + k]) k++;
    lcp[rankk[i] - 1] = k;
    k = max(0, k - 1);
  }
}
int k, q;
vector<pair<int, int> > v[N];
int modd[N];
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  string tmp;
  cin >> n >> k >> tmp >> q;
  for (int i = 0; i < 1e6; i++) modd[i] = i % k;
  vector<string> games(q);
  string ss;
  for (auto &it : games) cin >> it, ss += it + '*';
  int oldM = ss.size();
  ss += tmp;
  for (int i = 0; i < k - 1; i++) {
    ss += tmp[i];
  }
  ss += '{';
  m = ss.size();
  s = (unsigned char *)ss.c_str();
  SA_IS(s, sa, m + 1, 256, 1);
  for (int i = 0; i < m + 1; i++) {
    rankk[sa[i]] = i;
  }
  calc_lcp();
  for (int i = 0; i < games.size(); i++) {
    int idx = i * (k + 1);
    int pIdx = rankk[idx];
    set<int> vis;
    for (int j = pIdx; j < m && lcp[j] >= k; j++) {
      if (sa[j + 1] < oldM) continue;
      int realIdx = sa[j + 1] - oldM;
      int moded = modd[realIdx];
      if (vis.find(moded) != vis.end()) continue;
      vis.insert(moded);
      v[moded].push_back({realIdx, i});
    }
  }
  for (int i = 0; i <= k; i++) {
    if (v[i].size() >= n) {
      cout << "YES\n";
      sort(v[i].begin(), v[i].end());
      for (int j = 0; j < n; j++) cout << v[i][j].second + 1 << ' ';
      return 0;
    }
  }
  cout << "NO\n";
  return 0;
}
