#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
const int M = 1e9 + 7;
int n, m, num;
char s[maxn];
int p[maxn];
int nxt[maxn];
bool e[maxn];
void getnxt() {
  int j = 0;
  nxt[1] = 0;
  for (int i = 2; i <= m; i++) {
    while (j && s[j + 1] != s[i]) j = nxt[j];
    if (s[j + 1] == s[i]) j++;
    nxt[i] = j;
  }
  memset(e, 0, sizeof(e));
  for (int i = m; i > 0; i = nxt[i]) e[i] = 1;
}
long long solve() {
  for (int i = num; i >= 1; i--) {
    int dis = p[i + 1] - p[i];
    if (dis >= m)
      n -= m;
    else {
      int match = m - dis;
      if (!e[match])
        return 0;
      else
        n -= dis;
    }
  }
  long long ans = 1;
  while (n--) ans = (ans * 26) % M;
  return ans;
}
int main() {
  while (~scanf("%d%d", &n, &num)) {
    scanf("%s", s + 1);
    m = strlen(s + 1);
    getnxt();
    for (int i = 1; i <= num; i++) scanf("%d", &p[i]);
    p[num + 1] = n + 1;
    printf("%I64d\n", solve());
  }
  return 0;
}
