#include <bits/stdc++.h>
using namespace std;
const long long int m1 = 1e9 + 7, m2 = 1e9 + 9;
vector<long long int> v1, v2;
void precompute(long long int p, int MAX_SZ) {
  v1 = vector<long long int>(MAX_SZ);
  v2 = vector<long long int>(MAX_SZ);
  long long int p1 = 1, p2 = 1;
  for (int i = 0; i < MAX_SZ; i++) {
    v1[i] = p1;
    v2[i] = p2;
    p1 = (p1 * p) % m1;
    p2 = (p2 * p) % m2;
  }
}
struct Hash {
  vector<pair<int, int> > h;
  Hash(string &second) {
    if (!second.size()) return;
    h = vector<pair<int, int> >(second.size());
    pair<long long int, long long int> c_hash = {0, 0};
    h[0] = c_hash;
    for (int i = 0; i < second.size(); i++) {
      c_hash.first = (c_hash.first + (second[i] - 'a' + 1) * v1[i]) % m1;
      c_hash.second = (c_hash.second + (second[i] - 'a' + 1) * v2[i]) % m2;
      h[i] = c_hash;
    }
  }
  pair<int, int> getHash(int l, int r) {
    if (!h.size()) return {0, 0};
    long long int r1 = h[r].first, r2 = h[r].second;
    if (l) {
      r1 = (r1 - h[l - 1].first + m1) % m1;
      r2 = (r2 - h[l - 1].second + m2) % m2;
      int p = v1.size() - l - 1;
      r1 = (r1 * v1[p]) % m1;
      r2 = (r2 * v2[p]) % m2;
    } else {
      r1 = (r1 * v1.back()) % m1;
      r2 = (r2 * v2.back()) % m2;
    }
    return {r1, r2};
  }
};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  precompute(1e8 + 7, 2e6 + 5);
  int n, k, g;
  string str;
  cin >> n >> k;
  cin >> str;
  str += str;
  Hash h(str);
  cin >> g;
  map<pair<int, int>, int> mp;
  for (int i = 1; i <= g; i++) {
    cin >> str;
    Hash h1(str);
    mp[h1.getHash(0, k - 1)] = i;
  }
  int flag = 0;
  for (int i = 0; i < k && !flag; i++) {
    unordered_set<int> aux;
    vector<int> ans;
    for (int j = 0; j < n; j++) {
      int x = mp[h.getHash(j * k + i, j * k + i + k - 1)];
      if (!x || aux.count(x)) break;
      aux.insert(x);
      ans.push_back(x);
    }
    if (aux.size() == n) {
      cout << "YES" << endl;
      for (auto a : ans) {
        if (!flag)
          cout << a;
        else
          cout << " " << a;
        flag = 1;
      }
      cout << endl;
    }
  }
  if (!flag) cout << "NO" << endl;
  return 0;
}
