#include <bits/stdc++.h>
using namespace std;
const int NUM = 1e6 + 10;
const int inf = 0x3f3f3f3f;
const long long inf_ll = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + 7;
int n, m;
char str[NUM];
int nxt[NUM] = {0}, pos[NUM], mark[NUM] = {0};
int read() {
  int x = 0, v = 1;
  char ch = getchar();
  for (; ch < '0' || ch > '9'; v = (ch == '-') ? (-1) : (v), ch = getchar())
    ;
  for (; ch <= '9' && ch >= '0'; x = x * 10 + ch - '0', ch = getchar())
    ;
  return x * v;
}
long long qpow(long long a, long long n) {
  long long res = 1;
  while (n) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
void get_next() {
  int len = strlen(str + 1);
  nxt[0] = -1;
  nxt[1] = 0;
  int j;
  for (int i = 1; i <= len; i++) {
    j = nxt[i - 1];
    while (j != -1 && str[j + 1] != str[i]) j = nxt[j];
    nxt[i] = ++j;
  }
  for (int i = len; i > 0; i = nxt[i]) mark[i] = 1;
}
int main() {
  cin >> n >> m;
  scanf("%s", str + 1);
  int len = strlen(str + 1);
  get_next();
  for (int i = 1; i <= m; i++) scanf("%d", pos + i);
  if (!m) {
    cout << qpow(26, n) << endl;
    return 0;
  }
  for (int i = 1; i <= m; i++) {
    if (pos[i] + len - 1 > n) {
      cout << "0" << endl;
      return 0;
    }
    if (i == 1) continue;
    int pre = pos[i - 1];
    int cur = pos[i];
    if (pre + len > cur) {
      if (!mark[len - cur + pre]) {
        cout << "0" << endl;
        return 0;
      }
    }
  }
  int t = pos[1] - 1;
  for (int i = 2; i <= m; i++) {
    if (pos[i] - pos[i - 1] - len > 0) t += pos[i] - pos[i - 1] - len;
  }
  t += n - pos[m] - len + 1;
  cout << qpow(26, t) << endl;
  return 0;
}
