#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
const int mod = 1e9 + 7;
int z[maxn], pos[maxn], a[maxn];
string s;
int n, m, l;
void get_z(int n) {
  int l = 0, r = 0;
  for (int i = 1; i < n; i++) {
    if (i > r) {
      l = i, r = i;
      while (r < n && s[r - l] == s[r]) r++;
      z[i] = r - l, r--;
    } else {
      int k = i - l;
      if (z[k] < r - i + 1)
        z[i] = z[k];
      else {
        l = i;
        while (r < n && s[r - l] == s[r]) r++;
        z[i] = r - l, r--;
      }
    }
  }
}
bool chk(int i, int j) {
  if (i + l <= j) return 1;
  return z[j - i] >= i + l - j;
}
int ksm(int a, int b) {
  int res = 1;
  for (; b; b >>= 1) {
    if (b & 1) res = 1ll * res * a % mod;
    a = 1ll * a * a % mod;
  }
  return res;
}
signed main() {
  cin >> n >> m;
  cin >> s;
  l = s.size();
  get_z(l);
  for (int i = 1; i <= m; i++) cin >> pos[i], pos[i]--;
  for (int i = 1; i < m; i++) {
    if (chk(pos[i], pos[i + 1])) {
      a[pos[i]]++, a[pos[i] + l]--;
    } else {
      cout << 0 << endl;
      return 0;
    }
  }
  if (m) a[pos[m]]++, a[pos[m] + l]--;
  for (int i = 1; i < n; i++) a[i] += a[i - 1];
  int tot = 0;
  for (int i = 0; i < n; i++)
    if (!a[i]) tot++;
  cout << ksm(26, tot) << endl;
  return 0;
}
