#include <bits/stdc++.h>
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
using namespace std;
const long long N = 3e6 + 5;
const long long mod = 1e9 + 7;
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int INFi = 0x7f7f7f7f;
long long test = 1, n, k, q;
map<pair<long long, unsigned long long>, long long> ct;
string second;
long long base = 1e9 + 7;
const long long hMOD = 1e9 + 123;
long long pow1[N];
unsigned long long pow2[N];
long long pref1[N];
unsigned long long pref2[N];
void init_base() {
  pow1[0] = pow2[0] = 1;
  for (int i = 1; i < N; i++) {
    pow1[i] = pow1[i - 1] * base % hMOD;
    pow2[i] = pow2[i - 1] * base;
  }
}
struct PolyHash {
  PolyHash(const string& second) {
    int n = second.size();
    pref1[0] = pref2[0] = 0;
    for (int i = 1; i <= n; i++) {
      pref1[i] = (pref1[i - 1] + second[i] * pow1[i - 1]) % hMOD;
      pref2[i] = pref2[i - 1] + second[i] * pow2[i - 1];
    }
  }
  inline pair<long long, unsigned long long> operator()(
      const int pos, const int len, const int mxPow = 0) const {
    long long hash1 = pref1[pos + len - 1] - pref1[pos - 1];
    unsigned long long hash2 = pref2[pos + len - 1] - pref2[pos - 1];
    if (hash1 < 0) hash1 += hMOD;
    if (mxPow != 0) {
      hash1 = hash1 * pow1[mxPow - (pos + len - 1)] % hMOD;
      hash2 *= pow2[mxPow - (pos + len - 1)];
    }
    return make_pair(hash1, hash2);
  }
};
void solve() {
  init_base();
  cin >> n >> k >> second;
  second = '#' + second + second;
  cin >> q;
  for (int i = 1; i <= q; i++) {
    string t;
    cin >> t;
    PolyHash hash('#' + t);
    ct[hash(1, k, N)] = i;
  }
  PolyHash hash(second);
  for (int i = 1; i <= k; i++) {
    vector<long long> v;
    set<long long> second;
    for (int j = i; j < n * k + i; j += k) {
      pair<long long, unsigned long long> val = hash(j, k, N);
      if (ct.find(val) != ct.end())
        second.insert(ct[val]), v.push_back(ct[val]);
    }
    if (second.size() == n) {
      cout << "YES"
           << "\n";
      for (auto it : v) cout << it << " ";
      cout << "\n";
      ;
      return;
    }
  }
  cout << "NO"
       << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed;
  cout << setprecision(15);
  ;
  for (int i = 1; i <= test; i++) {
    solve();
  }
}
