#include <bits/stdc++.h>
using namespace std;
int n, k, g;
string s;
long long const mod1 = 1e5 + 7, mod2 = 1e5 - 3, base = 131;
long long H_ash[2001000][4];
vector<long long> v[mod1 + 100];
vector<int> num[mod1 + 100];
bool bl[101000];
int f_ind(long long m1, long long m2) {
  int p = v[m1].size();
  for (int j = 0; j < p; ++j)
    if (v[m1][j] == m2) return num[m1][j];
  return 0;
}
int main() {
  cin >> n >> k;
  cin >> s >> g;
  int l = s.size();
  for (int i = 1; i <= g; ++i) {
    string str;
    cin >> str;
    int l1 = str.size();
    long long m1 = 0, m2 = 0;
    for (int j = 0; j < l1; ++j)
      m1 = (m1 * base + str[j]) % mod1, m2 = (m2 * base + str[j]) % mod2;
    v[m1].push_back(m2);
    num[m1].push_back(i);
  }
  for (int i = 0; i < l + k - 1; ++i) {
    char ch;
    if (i < l)
      ch = s[i];
    else
      ch = s[i - l];
    H_ash[i + 1][1] = (H_ash[i][1] * base + ch) % mod1;
    H_ash[i + 1][2] = (H_ash[i][2] * base + ch) % mod2;
  }
  long long p1 = 1, p2 = 1;
  for (int i = 1; i <= k; ++i) {
    p1 = p1 * base % mod1;
    p2 = p2 * base % mod2;
  }
  for (int i = 0; i < k; ++i) {
    memset(bl, 0, sizeof(bl));
    bool flag = 1;
    int z = i + k;
    while (z <= l + k - 1) {
      long long m1 =
          ((H_ash[z][1] - H_ash[z - k][1] * p1) % mod1 + mod1) % mod1;
      long long m2 =
          ((H_ash[z][2] - H_ash[z - k][2] * p2) % mod2 + mod2) % mod2;
      int ans = f_ind(m1, m2);
      if ((!ans) || bl[ans]) {
        flag = 0;
        break;
      }
      bl[ans] = 1;
      z += k;
    }
    if (!flag) continue;
    cout << "YES\n";
    z = i + k;
    while (z <= l + k - 1) {
      long long m1 =
          ((H_ash[z][1] - H_ash[z - k][1] * p1) % mod1 + mod1) % mod1;
      long long m2 =
          ((H_ash[z][2] - H_ash[z - k][2] * p2) % mod2 + mod2) % mod2;
      int ans = f_ind(m1, m2);
      cout << ans << " ";
      z += k;
    }
    return 0;
  }
  cout << "NO\n";
  return 0;
}
