#include <bits/stdc++.h>
using namespace std;
int recur_depth = 0;
const long long MAX_N = 1e6 + 10, mod = 2e9 + 63, base1 = 1e9 + 21,
                base2 = 1e9 + 181;
char s[MAX_N];
long long pw1[MAX_N], pw2[MAX_N], slen;
void pw_calc() {
  pw1[0] = pw2[0] = 1;
  for (int i = 1; i < MAX_N; i++) {
    pw1[i] = (pw1[i - 1] * base1) % mod;
    pw2[i] = (pw2[i - 1] * base2) % mod;
  }
}
struct Hash {
  long long h1[MAX_N], h2[MAX_N];
  void init() {
    h1[0] = h2[0] = 0;
    for (int i = 1; i <= slen; i++) {
      h1[i] = (h1[i - 1] * base1 + s[i]) % mod;
      h2[i] = (h2[i - 1] * base2 + s[i]) % mod;
    }
  }
  inline void add(long long ch, long long i) {
    if (i == 1) h1[0] = h2[0] = 0;
    h1[i] = (h1[i - 1] * base1 + ch) % mod;
    h2[i] = (h2[i - 1] * base2 + ch) % mod;
  }
  inline long long hashVal(int l, int r) {
    long long hsh1 = (h1[r] - h1[l - 1] * pw1[r - l + 1]) % mod;
    if (hsh1 < 0) hsh1 += mod;
    long long hsh2 = (h2[r] - h2[l - 1] * pw2[r - l + 1]) % mod;
    if (hsh2 < 0) hsh2 += mod;
    return (hsh1 << 32) | hsh2;
  }
} fw, fw2;
const long long MOD = 1e9 + 7;
long long fastPow(long long x, long long n, long long MOD) {
  long long ret = 1;
  while (n) {
    if (n & 1) ret = (ret * x) % MOD;
    x = (x * x) % MOD;
    n >>= 1;
  }
  return ret % MOD;
}
int main() {
  pw_calc();
  long long n, m;
  cin >> n >> m;
  scanf("%s", s + 1);
  slen = strlen(s + 1);
  fw.init();
  long long idx = 0, cnt = 0, ans = 0, ok = 1;
  for (long long i = 1; i <= m; ++i) {
    long long y;
    scanf("%lld", &y);
    for (long long i = idx + 1; i < y; i++) {
      fw2.add('?', i);
      cnt++;
    }
    if (idx >= y) {
      long long len = idx - y + 1;
      if (fw.hashVal(1, len) != fw2.hashVal(y, idx)) {
        ans = ok = 0;
        break;
      }
    }
    long long start = max(1LL, idx - y + 1 + 1);
    long long cur = y + start - 1;
    for (long long i = start; i <= slen; i++) {
      fw2.add(s[i], cur);
      cur++;
    }
    idx = y + slen - 1;
  }
  cnt += (n - idx);
  if (!ok)
    printf("0\n");
  else
    printf("%lld\n", fastPow(26, cnt, MOD));
  return 0;
}
