#include <bits/stdc++.h>
using namespace std;
long long n, m, h1[1000000LL + 10], h2[1000000LL + 10], p27_1[1000000LL + 10],
    p27_2[1000000LL + 10], fr[1000000LL + 10], mars[1000000LL + 10], P;
string s;
deque<long long> dq;
long long calcHash1(long long l, long long r) {
  if (!l) return h1[r];
  return (h1[r] - h1[l - 1] * p27_1[r - l + 1] + 666017LL * 666017LL) %
         666017LL;
}
long long calcHash2(long long l, long long r) {
  if (!l) return h2[r];
  return (h2[r] - h2[l - 1] * p27_2[r - l + 1] + 666013LL * 666013LL) %
         666013LL;
}
int main() {
  cin >> n >> m >> s;
  long long ns = s.size();
  h1[0] = h2[0] = s[0] - 'a' + 1;
  p27_1[0] = p27_2[0] = 1;
  for (long long i = 1; i <= ns; i++)
    p27_1[i] = p27_1[i - 1] * 27 % 666017LL,
    p27_2[i] = p27_2[i - 1] * 27 % 666013LL;
  for (long long i = 1; i < ns; i++) {
    h1[i] = (h1[i - 1] * 27 + s[i] - 'a' + 1) % 666017LL;
    h2[i] = (h2[i - 1] * 27 + s[i] - 'a' + 1) % 666013LL;
  }
  if (ns == 1)
    P = 1;
  else
    for (long long p = 1; p <= ns; p++) {
      long long dif = ns - p;
      long long hash1_1 = calcHash1(p, min(1000000LL, ns - 1)),
                hash2_1 = calcHash1(0, min(1000000LL, dif - 1));
      long long hash1_2 = calcHash2(p, min(1000000LL, ns - 1)),
                hash2_2 = calcHash2(0, min(1000000LL, dif - 1));
      if (hash1_1 == hash2_1 && hash1_2 == hash2_2) {
        P = p;
        break;
      }
    }
  long long curr = 0;
  for (long long i = 1; i <= m; i++) {
    long long x;
    cin >> x;
    mars[x]++;
    mars[x + ns]--;
    while (!dq.empty() && x - dq.front() >= ns) {
      fr[dq.front() % P]--;
      if (!fr[dq.front() % P]) curr--;
      dq.pop_front();
    }
    if (!fr[x % P]) curr++;
    fr[x % P]++;
    if (curr > 1) {
      cout << 0 << '\n';
      return 0;
    }
    dq.push_back(x);
  }
  long long cnt = 0;
  for (long long i = 1; i <= n; i++) {
    mars[i] = mars[i] + mars[i - 1];
    if (!mars[i]) cnt++;
  }
  long long ans = 1;
  for (long long i = 1; i <= cnt; i++) ans = ans * 26 % 1000000007LL;
  cout << ans << '\n';
  return 0;
}
