#include <bits/stdc++.h>
const int p = 107;
std::map<int, std::vector<int> > hash_table;
char s[1100005], ss[2000005];
bool check(int x, int y, int k) {
  for (int i = 0; i < k; i++)
    if (s[x + i] != ss[y + i]) return 0;
  return 1;
}
int a[100005], b[100005], f[1100010];
void solve() {
  int n, k, g;
  scanf("%d%d\n%s%d\n", &n, &k, s + 1, &g);
  int len = n * k;
  for (int i = 1; i < k; i++) s[len + i] = s[i];
  for (int i = 1; i < len + k; i++) f[i] = f[i - 1] * p + s[i] - 'a' + 1;
  int st = 0;
  for (int i = 1; i <= g; i++) {
    scanf("%s", ss + st);
    int h = 0;
    for (int j = 0; j < k; j++) h = h * p + ss[st + j] - 'a' + 1;
    hash_table[h].push_back(i);
    st += k;
  }
  int pow = 1;
  for (int i = 1; i <= k; i++) pow *= p;
  for (int i = 1, j; i <= k; i++) {
    int m = 0;
    for (j = i; j <= len; j += k) {
      int x = f[j + k - 1] - pow * f[j - 1], y = hash_table[x].size(), z = 0;
      if (y == 0) break;
      if (y == 1) z = hash_table[x][0];
      if (y > 1) {
        for (int l = 0; l < y; l++)
          if (check(j, (hash_table[x][l] - 1) * k, k)) {
            z = hash_table[x][l];
            break;
          }
      }
      if (!z || b[z]) break;
      b[a[++m] = z] = 1;
    }
    if (j > len) {
      printf("YES\n");
      for (j = 1; j <= m; j++) printf("%d ", a[j]);
      return;
    }
    for (j = 1; j <= m; j++) b[a[j]] = 0;
  }
  printf("NO\n");
}
int main() {
  solve();
  return 0;
}
