#include <bits/stdc++.h>
const int MAXN = 1000100;
const int MOD = 1000000007;
void PreKMP(char s[], int next[]) {
  int i = 1, j = 0;
  next[0] = -1;
  next[1] = 0;
  while (s[i]) {
    if (j == -1 || s[i] == s[j])
      next[++i] = ++j;
    else
      j = next[j];
  }
}
long long ModPow(long long x, long long y, long long z) {
  long long ans = 1;
  while (y) {
    if (y & 1) ans = ans * x % z;
    x = x * x % z;
    y >>= 1;
  }
  return ans;
}
char p[MAXN];
int next[MAXN];
bool flag[MAXN];
int main() {
  int n, m, y;
  scanf("%d%d", &n, &m);
  scanf("%s", p);
  PreKMP(p, next);
  int len = strlen(p), last = 1;
  for (int i = len; i; i = next[i]) flag[len - next[i]] = true;
  long long ans = 1;
  while (m--) {
    scanf("%d", &y);
    if (y > last)
      ans = ans * ModPow(26, y - last, MOD) % MOD;
    else if (!flag[y + len - last])
      ans = 0;
    last = y + len;
  }
  ans = ans * ModPow(26, n - last + 1, MOD) % MOD;
  printf("%lld\n", ans);
  return 0;
}
