#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1000010;
const int mod = 1e9 + 7;
const int base = 233, base1 = 23333;
const int inf = 2147483647;
const double pi = acos(-1.0);
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * f;
}
int pw[Maxn], pw1[Maxn], Hash[Maxn], Hash1[Maxn];
int n, m, a[Maxn];
char s[Maxn];
int g(int l, int r) {
  return (Hash[l] - (long long)Hash[r + 1] * pw[r - l + 1] % mod + mod) % mod;
}
int g1(int l, int r) {
  return (Hash1[l] - (long long)Hash1[r + 1] * pw1[r - l + 1] % mod + mod) %
         mod;
}
int main() {
  int ans = 1;
  n = read(), m = read();
  scanf("%s", s + 1);
  int len = strlen(s + 1);
  pw[0] = 1;
  for (int i = 1; i <= n; i++) pw[i] = (long long)pw[i - 1] * base % mod;
  pw1[0] = 1;
  for (int i = 1; i <= n; i++) pw1[i] = (long long)pw1[i - 1] * base1 % mod;
  Hash[len + 1] = 0;
  for (int i = len; i; i--)
    Hash[i] = (s[i] - 'a' + (long long)Hash[i + 1] * base % mod) % mod;
  Hash1[len + 1] = 0;
  for (int i = len; i; i--)
    Hash1[i] = (s[i] - 'a' + (long long)Hash1[i + 1] * base1 % mod) % mod;
  int lst = -inf;
  while (m--) {
    int x = read();
    if (lst + len - 1 < x) {
      a[x]++;
      a[min(n, x + len - 1) + 1]--;
    } else {
      int t = (lst + len - 1) - x + 1;
      if (g(1, t) != g(len - t + 1, len) && g1(1, t) != g1(len - t + 1, len))
        ans = 0;
      else {
        a[x]++;
        a[min(n, x + len - 1) + 1]--;
      }
    }
    lst = x;
  }
  for (int i = 1; i <= n; i++) {
    a[i] += a[i - 1];
    if (!a[i]) ans = (long long)ans * 26ll % mod;
  }
  printf("%d", ans);
}
