#include <bits/stdc++.h>
using namespace std;
const long long Mod = 1000000007;
long long n, m, ans, nxt[1000100], vis[1000100], a[1000100];
char s[1000100];
signed main() {
  scanf("%lld%lld", &n, &m);
  scanf("%s", s);
  nxt[0] = nxt[1] = 0;
  long long len = strlen(s);
  long long k = 0;
  for (long long i = 1; i < len; i++) {
    while (k && s[i] != s[k]) k = nxt[k];
    if (s[i] == s[k]) nxt[i + 1] = ++k;
  }
  k = nxt[len];
  while (k) {
    vis[k] = 1;
    k = nxt[k];
  }
  if (m != 0) ans = len;
  for (long long i = 1; i <= m; i++) scanf("%lld", &a[i]);
  for (long long i = 2; i <= m; i++) {
    long long x = a[i - 1] + len - 1, y = a[i] + len - 1;
    if (x < a[i])
      ans += len;
    else if (vis[x - a[i] + 1])
      ans += y - x;
    else {
      puts("0");
      return 0;
    }
  }
  long long b = 1;
  for (long long i = 1; i <= n - ans; i++) b = (b * 26ll) % Mod;
  printf("%lld\n", b);
}
