#include <bits/stdc++.h>
using namespace std;
template <typename T>
T in() {
  char ch;
  T n = 0;
  bool ng = false;
  while (1) {
    ch = getchar();
    if (ch == '-') {
      ng = true;
      ch = getchar();
      break;
    }
    if (ch >= '0' && ch <= '9') break;
  }
  while (1) {
    n = n * 10 + (ch - '0');
    ch = getchar();
    if (ch < '0' || ch > '9') break;
  }
  return (ng ? -n : n);
}
template <typename T>
inline T POW(T B, T P) {
  if (P == 0) return 1;
  if (P & 1)
    return B * POW(B, P - 1);
  else
    return (POW(B, P / 2) * POW(B, P / 2));
}
template <typename T>
inline T Gcd(T a, T b) {
  if (a < 0) return Gcd(-a, b);
  if (b < 0) return Gcd(a, -b);
  return (b == 0) ? a : Gcd(b, a % b);
}
template <typename T>
inline T Lcm(T a, T b) {
  if (a < 0) return Lcm(-a, b);
  if (b < 0) return Lcm(a, -b);
  return a * (b / Gcd(a, b));
}
long long Bigmod(long long base, long long power, long long MOD) {
  long long ret = 1;
  while (power) {
    if (power & 1) ret = (ret * base) % MOD;
    base = (base * base) % MOD;
    power >>= 1;
  }
  return ret;
}
bool isVowel(char ch) {
  ch = toupper(ch);
  if (ch == 'A' || ch == 'U' || ch == 'I' || ch == 'O' || ch == 'E')
    return true;
  return false;
}
template <typename T>
long long int isLeft(T a, T b, T c) {
  return (a.x - b.x) * (b.y - c.y) - (b.x - c.x) * (a.y - b.y);
}
long long ModInverse(long long number, long long MOD) {
  return Bigmod(number, MOD - 2, MOD);
}
bool isConst(char ch) {
  if (isalpha(ch) && !isVowel(ch)) return true;
  return false;
}
int toInt(string s) {
  int sm;
  stringstream second(s);
  second >> sm;
  return sm;
}
pair<long long int, long long int> Hs[2000007];
long long int B1[2000007];
long long int B2[2000007];
void Init() {
  B1[0] = 1;
  B2[0] = 1;
  for (int i = 1; i < 2000007; i++) {
    B1[i] = (B1[i - 1] * 10000019LL) % 1000000007LL;
    B2[i] = (B2[i - 1] * 10000079LL) % 1000000009LL;
  }
}
pair<long long int, long long int> GetHsh(string s) {
  pair<long long int, long long int> tp = make_pair(0, 0);
  for (int i = 1; i <= s.size(); i++) {
    int dgt = (s[i - 1] - 'a');
    tp.first = (tp.first * 10000019LL + dgt) % 1000000007LL;
    tp.second = (tp.second * 10000079LL + dgt) % 1000000009LL;
  }
  return tp;
}
map<pair<long long int, long long int>, int> mp;
string s;
int N;
void Gen() {
  Hs[0] = make_pair(0, 0);
  for (int i = 1; i <= N; i++) {
    int dgt = (s[i - 1] - 'a');
    Hs[i].first = (Hs[i - 1].first * 10000019LL + dgt) % 1000000007LL;
    Hs[i].second = (Hs[i - 1].second * 10000079LL + dgt) % 1000000009LL;
  }
  return;
}
int n, k;
int ar[2000007];
pair<long long int, long long int> Subhash(int l, int r);
pair<long long int, long long int> Dekhi(int p) {
  int bk = k - p + 1;
  pair<long long int, long long int> tp = Subhash(N - bk + 1, N);
  tp.first = (tp.first * B1[p - 1]) % 1000000007LL;
  tp.first = (tp.first + Hs[p - 1].first) % 1000000007LL;
  tp.second = (tp.second * B2[p - 1]) % 1000000009LL;
  tp.second = (tp.second + Hs[p - 1].second) % 1000000009LL;
  return tp;
}
int P;
pair<long long int, long long int> Subhash(int l, int r) {
  int len = (r - l + 1);
  pair<long long int, long long int> ans;
  if (r > N) return Dekhi(P);
  ans.first = (Hs[r].first - Hs[l - 1].first * B1[len]) % 1000000007LL;
  ans.first = (ans.first + 1000000007LL) % 1000000007LL;
  ans.second = (Hs[r].second - Hs[l - 1].second * B2[len]) % 1000000009LL;
  ans.second = (ans.second + 1000000009LL) % 1000000009LL;
  return ans;
}
int vis[2000007], KS;
bool IsPossible(int p) {
  int L = 0;
  ++KS;
  P = p;
  for (int i = p; i <= N; i += k) {
    pair<long long int, long long int> tp = Subhash(i, i + k - 1);
    if (mp.find(tp) == mp.end()) {
      return 0;
    } else {
      ar[L++] = mp[tp];
      if (vis[ar[L - 1]] == KS) {
        return 0;
      }
      vis[ar[L - 1]] = KS;
    }
  }
  printf("YES\n");
  for (int i = 0; i < L; i++) printf("%d ", ar[i]);
  return 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  Init();
  cin >> n >> k;
  cin >> s;
  N = s.size();
  Gen();
  int g;
  cin >> g;
  for (int i = 1; i < g + 1; i++) {
    string p;
    cin >> p;
    mp[GetHsh(p)] = i;
  }
  for (int i = 1; i <= k; i++) {
    if (IsPossible(i)) {
      exit(0);
    }
  }
  printf("NO\n");
  return 0;
}
