#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
char str[1000009];
int fail[1000009];
int is_prefix[1000009];
int N, M;
int main() {
  scanf("%d%d", &N, &M);
  scanf("%s", &str);
  int len = strlen(str);
  fail[0] = -1;
  int j = -1;
  memset(is_prefix, 0, sizeof(is_prefix));
  for (int i = 1; i < len; i++) {
    while (j != -1 && str[i] != str[j + 1]) j = fail[j];
    if (str[j + 1] == str[i]) j++;
    fail[i] = j;
  }
  j = len - 1;
  int e = 0;
  while (fail[j] != -1) {
    e += j - fail[j];
    is_prefix[e] = 1;
    j = fail[j];
  }
  int flag = 1;
  int p = 0;
  int last = 0;
  for (int i = 0; i < M; i++) {
    int y;
    scanf("%d", &y);
    p += max(0, y - last - 1);
    if (y <= last) flag &= is_prefix[y - (last - len + 1)];
    last = y + len - 1;
  }
  p += max(0, N - last);
  int ans = 0;
  if (flag) {
    ans = 1;
    for (int i = 0; i < p; i++) ans = (ans * 26ll) % MOD;
  }
  printf("%d\n", ans);
  return 0;
}
