#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5, mod = 1e9 + 7;
inline int qpow(int a, int b) {
  int res = 1, tp = a;
  while (b) {
    if (b & 1) res = 1ll * res * tp % mod;
    tp = 1ll * tp * tp % mod;
    b >>= 1;
  }
  return res;
}
int lenp, n, m;
char p[N];
int z[N], pos[N];
void get_z(char *s1, int n) {
  int L = 0, R = 0;
  for (register int i = 1; i <= n - 1; i++) {
    if (i > R) {
      L = i, R = i;
      while (R < n && s1[R - L] == s1[R]) R++;
      z[i] = --R - L + 1;
    } else {
      int k = i - L;
      if (z[k] < R - i + 1)
        z[i] = z[k];
      else {
        L = i;
        while (R < n && s1[R - L] == s1[R]) R++;
        z[i] = --R - L + 1;
      }
    }
  }
}
int ans, sum[N], ls;
bool check(int x, int y) {
  if (y - x >= lenp) return true;
  return z[y - x] >= x + lenp - y;
}
int main() {
  scanf("%d%d", &n, &m);
  if (!m) return printf("%d\n", qpow(26, n)), 0;
  scanf("%s", p);
  lenp = strlen(p);
  get_z(p, lenp);
  for (register int i = 1; i <= m; i++)
    scanf("%d", &pos[i]), pos[i]--, sum[pos[i]]++, sum[pos[i] + lenp]--;
  for (register int i = 2; i <= m; i++) {
    if (!check(pos[i - 1], pos[i])) return puts("0"), 0;
  }
  for (register int i = 0; i <= n - 1; i++) {
    sum[i] += sum[i - 1];
    if (!sum[i]) ans++;
  }
  return printf("%d\n", qpow(26, ans)), 0;
}
