#include <bits/stdc++.h>
using namespace std;
long long int mod = 1000000007;
int kmp[1000006];
void find_kmp(char* a, int n) {
  int i, j;
  j = 0;
  i = 1;
  kmp[0] = 0;
  while (i < n) {
    if (a[i] == a[j]) {
      kmp[i] = j + 1;
      i++;
      j++;
    } else {
      if (j == 0) {
        kmp[i] = 0;
        i++;
      } else {
        j = kmp[j - 1];
      }
    }
  }
}
long long int power(long long int a, int n) {
  long long int ans = 1 % mod;
  while (n > 0) {
    if (n & 1) {
      ans = (ans * a) % mod;
    }
    a = (a * a) % mod;
    n = n >> 1;
  }
  return ans % mod;
}
int main() {
  int n, m, p, i, slen, t, cr = 0;
  int y[1000006];
  char a[1000006];
  cin >> n >> m;
  cin >> a;
  for (i = 0; i < m; i++) {
    cin >> y[i];
    y[i]--;
  }
  slen = strlen(a);
  find_kmp(a, slen);
  vector<int> tmp;
  t = kmp[slen - 1];
  while (t > 0) {
    tmp.push_back(t);
    t = kmp[t - 1];
  }
  sort(tmp.begin(), tmp.end());
  for (i = 1; i < m; i++) {
    if (y[i] >= y[i - 1] + slen) {
      cr = cr + slen;
    } else if (binary_search(tmp.begin(), tmp.end(), y[i - 1] + slen - y[i])) {
      cr = cr + (y[i] - y[i - 1]);
    } else {
      cr = n + 1;
      break;
    }
  }
  if (m > 0) {
    cr = cr + slen;
  }
  cr = n - cr;
  if (cr < 0) {
    cout << 0 << endl;
  } else {
    cout << power(26, cr) << endl;
  }
  return 0;
}
