#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e6 + 7;
const long long MOD = 1000 * 1000 * 1000 + 7;
const long long C = 26;
long long mod(long long n) { return (n % MOD + MOD) % MOD; }
long long HMOD = -1;
bool prime(long long n) {
  for (long long d = 2; d * d <= n; ++d) {
    if (n % d == 0) return 0;
  }
  return 1;
}
const long long BASE = 129;
const long long MN = 1000 * 1000 * 1000;
const long long ADD = 1e6 + 7;
mt19937 rnd(time(0));
void gen() {
  while (1) {
    HMOD = MN + rnd() % ADD;
    if (prime(HMOD)) {
      break;
    }
  }
}
long long hmod(long long n) { return (n % HMOD + HMOD) % HMOD; }
string t;
long long h[MAXN];
long long pw[MAXN];
void calc() {
  for (long long i = 0; i < (long long)t.size(); ++i)
    h[i + 1] = hmod(h[i] * BASE + t[i]);
  pw[0] = 1;
  for (long long i = 1; i < MAXN; ++i) pw[i] = hmod(pw[i - 1] * BASE);
}
long long geth(long long l, long long r) {
  return hmod(h[r + 1] - h[l] * pw[r - l + 1]);
}
bool check(long long i, long long j) {
  if (i + t.size() - 1 < j) return 1;
  long long p = j - i;
  long long len = t.size() - p;
  return geth(p, t.size() - 1) == geth(0, len - 1);
}
long long add[MAXN];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, m;
  cin >> n >> m;
  cin >> t;
  vector<long long> a(m);
  for (long long i = 0; i < m; ++i) {
    cin >> a[i];
    --a[i];
  }
  gen();
  calc();
  for (long long i = 0; i < m - 1; ++i) {
    if (!check(a[i], a[i + 1])) {
      cout << "0\n";
      exit(0);
    }
  }
  for (long long i = 0; i < m; ++i) {
    ++add[a[i]];
    --add[a[i] + t.size()];
  }
  long long ans = 1;
  long long curr = 0;
  for (long long i = 0; i < n; ++i) {
    curr += add[i];
    if (!curr) ans = mod(ans * C);
  }
  cout << ans << '\n';
  return 0;
}
