#include <bits/stdc++.h>
using namespace std;
const int NM = 1000005;
const int Mod = 1000000007;
int N, m, n, p26 = 0, pi[NM], i, x, y, b[NM];
char a[NM];
bool kmp[NM];
long long put(long long a, int b) {
  if (!b) return 1;
  if (b & 1) return a * put(a * a % Mod, b >> 1) % Mod;
  return put(a * a % Mod, b >> 1);
}
void KMP() {
  int i, k = 0;
  pi[1] = 0;
  for (i = 2; i <= n; ++i) {
    while (k && a[i] != a[k + 1]) k = pi[k];
    if (a[i] == a[k + 1]) ++k;
    pi[i] = k;
  }
  while (k) {
    kmp[k] = 1;
    k = pi[k];
  }
}
int main() {
  scanf("%d %d\n", &N, &m);
  gets(a + 1);
  n = strlen(a + 1);
  KMP();
  if (!m) {
    printf("%I64d\n", put(26LL, N));
    return 0;
  }
  for (i = 1; i <= m; ++i) scanf("%d", &b[i]);
  p26 += b[1] - 1;
  for (i = 1; i < m; ++i) {
    x = b[i] + n - 1;
    y = b[i + 1];
    if (x < y)
      p26 += y - x - 1;
    else if (!kmp[x - y + 1]) {
      printf("0\n");
      return 0;
    }
  }
  p26 += N;
  p26 -= b[i] + n - 1;
  printf("%I64d\n", put(26LL, p26));
  return 0;
}
