#include <bits/stdc++.h>
using namespace std;
bool debug;
const int inf = 1e9 + 5;
const long long INF = (long long)inf * inf;
const int nax = 1e6 + 5;
const long long md = 1e9 + 7;
const long long C = 29;
long long h[nax];
long long pot[nax];
char sl[nax];
int n;
int x[nax];
int c[nax];
bool rowne(int a, int b, int d) {
  long long h1 = h[a + d - 1] - h[a - 1] + md;
  long long h2 = h[b + d - 1] - h[b - 1] + md;
  return h1 * pot[n - a] % md == h2 * pot[n - b] % md;
}
int main(int argc, char *argv[]) {
  debug = argc > 1;
  int q;
  scanf("%d%d", &n, &q);
  scanf("%s", sl);
  pot[0] = 1;
  for (int i = 1; i <= nax - 1; ++i) pot[i] = (pot[i - 1] * C) % md;
  for (int i = 0; i <= (n)-1; ++i)
    h[i] = ((i ? h[i - 1] : 0) + (sl[i] - 'a') * pot[i]) % md;
  for (int i = 1; i <= q; ++i) scanf("%d", &x[i]);
  int d = strlen(sl);
  for (int i = 2; i <= q; ++i) {
    int a = x[i - 1];
    int b = x[i];
    if (a + d > b && !rowne(0, b - a, a + d - b)) {
      puts("0");
      return 0;
    }
  }
  for (int i = 1; i <= q; ++i) {
    c[x[i]]++;
    c[x[i] + d]--;
  }
  int counter = 0;
  long long res = 1;
  for (int i = 1; i <= n; ++i) {
    counter += c[i];
    if (counter == 0) res = res * 26 % md;
  }
  printf("%lld\n", res);
  return 0;
}
