#include <bits/stdc++.h>
using namespace std;
template <class _T>
inline void ina(_T a[], int n) {
  for (int i = 0; i < n; i++) cin >> (a[i]);
}
int TEST_CASE = 0;
template <class _T>
inline _T pow(_T a, _T b, _T m) {
  a %= m;
  _T ans = 1 % m;
  while (b) {
    if (b & 1) ans *= a, ans %= m;
    a *= a;
    a %= m;
    b >>= 1;
  }
  return ans;
}
template <class _T>
inline _T pow(_T a, _T b) {
  _T ans = 1;
  while (b) {
    if (b & 1) ans *= a;
    a *= a;
    b >>= 1;
  }
  return ans;
}
template <class _T>
inline _T add(_T a, _T b, _T m) {
  return a >= m - b ? a - (m - b) : a + b;
}
template <class _T>
inline _T multiply(_T a, _T b, _T m) {
  _T ans = 0;
  if (b > a) swap(a, b);
  while (b) {
    if (b & 1) ans = add(ans, a, m);
    b >>= 1;
    a = add(a, a, m);
  }
  return ans;
}
template <class _T>
inline _T bigpow(_T a, _T b, _T m) {
  a %= m;
  _T ans = 1 % m;
  while (b) {
    if (b & 1) ans = multiply(ans, a, m);
    a = multiply(a, a, m);
    b >>= 1;
  }
  return ans;
}
template <class _T>
inline _T modinvers(_T a, _T m) {
  return m > 2000000000LL ? bigpow(a, m - 2, m) : pow(a, m - 2, m);
}
template <class _T>
_T _egcd(_T a, _T b, _T &x, _T &y) {
  if (!b) {
    x = 1, y = 0;
    return a;
  }
  _T _g = _egcd(b, a % b, x, y);
  _T xt = x;
  x = y, y = xt - (a / b) * y;
  return _g;
}
template <class _T>
inline _T fmodinvers(_T a, _T m) {
  _T x, y;
  _egcd(a, m, x, y);
  x %= m;
  if (x < 0) x += m;
  return x;
}
template <class _T>
inline _T _lcm(_T a, _T b) {
  return (a * b) / __gcd(a, b);
}
template <class T>
inline T SQ(T a) {
  return a * a;
}
long long SQRT(long long n) {
  long long e = sqrt(n * 1.0);
  long long l = max(0LL, e - 2), r = min(n, e + 2);
  long long ans = 0;
  while (l <= r) {
    long long m = ((l + r) >> 1);
    if (m * m <= n)
      ans = m, l = m + 1;
    else
      r = m - 1;
  }
  return ans;
}
long long CBRT(long long n) {
  long long e = cbrt(n * 1.0);
  long long l = max(0LL, e - 2), r = min(n, e + 2);
  long long ans = 0;
  while (l <= r) {
    long long m = ((l + r) >> 1);
    if (m * m * m <= n)
      ans = m, l = m + 1;
    else
      r = m - 1;
  }
  return ans;
}
const long double EPS = 1e-9;
const long double PI = acos(-1.0);
const int SIZE = 1e6;
long long mod = 1e9 + 7;
int tri[2000005][26], avl = 2;
int link[2000005];
unordered_map<int, int> M;
int id;
void ins(char *s) {
  int u = 1;
  for (int i = 0; s[i]; i++) {
    int c = s[i] - 'a';
    if (!tri[u][c]) tri[u][c] = avl++;
    u = tri[u][c];
  }
  M[u] = id;
}
void constructSL() {
  queue<int> q;
  for (int c = 0; c < 26; c++) {
    if (tri[1][c])
      link[tri[1][c]] = 1, q.push(tri[1][c]);
    else
      tri[1][c] = 1;
  }
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int c = 0; c < 26; c++) {
      if (tri[u][c]) {
        int v = tri[u][c];
        q.push(v);
        int w = link[u];
        while (!tri[w][c]) w = link[w];
        link[v] = tri[w][c];
      }
    }
  }
}
int P[2000005];
void run(char *s) {
  int u = 1;
  for (int i = 0; s[i]; i++) {
    int c = s[i] - 'a';
    while (!tri[u][c]) {
      u = link[u];
    }
    u = tri[u][c];
    if (((M).find(u) != (M).end()))
      P[i] = M[u];
    else
      P[i] = -1;
  }
}
char t[2000005], s[2000005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  cin >> t;
  int nn = n * k;
  for (int i = 0; i < nn; i++) t[i + nn] = t[i];
  int m;
  cin >> m;
  for (int i = 1; i <= m; i++) {
    id = i;
    cin >> s;
    ins(s);
  }
  constructSL();
  run(t);
  for (int i = 0; i < k; i++) {
    int fnd = 1;
    unordered_set<int> r;
    vector<int> f;
    for (int j = 1; j <= n; j++) {
      if (~P[i + k * j - 1]) {
        if (((r).find(P[i + k * j - 1]) != (r).end())) {
          fnd = 0;
          break;
        } else {
          r.insert(P[i + k * j - 1]);
          f.push_back(P[i + k * j - 1]);
        }
      } else {
        fnd = 0;
        break;
      }
    }
    if (fnd) {
      cout << "YES\n";
      for (int y : f) cout << y << " ";
      cout << '\n';
      return 0;
    }
  }
  cout << "NO\n";
  return 0;
}
