#include <bits/stdc++.h>
using namespace std;
const int MN = 1e6 + 7, Mo = 1e9 + 7;
int T[MN], sa[MN], tsa[MN], rk[MN * 2], trk[MN], c[MN], height[MN];
void bsort(int k, int n) {
  int i;
  memset(c, 0, sizeof(c));
  for (i = 0; i < n; i++) c[rk[i + k]]++;
  for (i = 1; i < n; i++) c[i] += c[i - 1];
  for (i = n - 1; i >= 0; i--) tsa[--c[rk[i + k]]] = i;
  memset(c, 0, sizeof(c));
  for (i = 0; i < n; i++) c[rk[i]]++;
  for (i = 1; i < n; i++) c[i] += c[i - 1];
  for (i = n - 1; i >= 0; i--) sa[--c[rk[tsa[i]]]] = tsa[i];
}
void getsa(int *T, int *sa, int n) {
  int i, k, p;
  memset(rk, 0, sizeof(rk));
  memset(c, 0, sizeof(c));
  for (i = 0; i < n; i++) c[T[i]]++;
  for (i = 1; i < max(n, 128); i++) c[i] += c[i - 1];
  for (i = n - 1; i >= 0; i--) sa[--c[T[i]]] = i;
  rk[sa[0]] = p = 1;
  for (i = 1; i < n; i++) rk[sa[i]] = (T[sa[i]] == T[sa[i - 1]]) ? p : ++p;
  for (k = 1; k <= n && p < n; k <<= 1) {
    bsort(k, n);
    trk[sa[0]] = p = 1;
    for (i = 1; i < n; i++)
      trk[sa[i]] =
          (rk[sa[i - 1]] == rk[sa[i]] && rk[sa[i - 1] + k] == rk[sa[i] + k])
              ? p
              : ++p;
    for (i = 0; i < n; i++) rk[i] = trk[i];
  }
}
void getheight(int *T, int *sa, int *height, int n) {
  int i, j, k;
  for (i = 0; i < n; i++) rk[sa[i]] = i;
  k = 0;
  height[0] = 0;
  for (i = 0; i < n; i++) {
    if (k) k--;
    if (rk[i] == 0) continue;
    int j = sa[rk[i] - 1];
    while (i + k < n && j + k < n && T[i + k] == T[j + k]) k++;
    height[rk[i]] = k;
  }
}
long long qm(long long a, long long n) {
  long long rst = 1;
  for (; n; n >>= 1, a = a * a % Mo)
    if (n & 1) rst = rst * a % Mo;
  return rst;
}
int N, M;
char ss[MN];
int a[MN], same[MN];
int main() {
  scanf("%d%d", &N, &M);
  scanf("%s", ss);
  int len = strlen(ss);
  for (int i = 0; i < len; i++) T[i] = ss[i] - 'a' + 1;
  getsa(T, sa, len);
  getheight(T, sa, height, len);
  same[rk[0]] = len;
  for (int i = rk[0] - 1; i >= 0; i--)
    same[i] = min(same[i + 1], height[i + 1]);
  for (int i = rk[0] + 1; i < len; i++)
    same[i] = min(same[i - 1], height[i - 1]);
  for (int i = 0; i < M; i++) scanf("%d", a + i);
  sort(a, a + M);
  int cover = 0, last = 0;
  for (int i = 0; i < M; i++) {
    if (a[i] < last) {
      int com = last - a[i];
      if (same[rk[len - com]] < com) cover = N + 1;
      cover += len - com;
    } else {
      cover += len;
    }
    last = a[i] + len;
  }
  if (cover > N) {
    puts("0");
    return 0;
  }
  int left = max(0, N - cover);
  printf("%lld\n", qm(26, left));
  return 0;
}
