#include <bits/stdc++.h>
using namespace std;
int n, m, tmp, len, ans;
const int N = 1e6 + 5, P = 1000000007;
int nxt[N];
char b[N];
pair<int, int> t[N];
bool vis[N];
inline int power(int a, int b) {
  int ret = 1;
  while (b) {
    if (b & 1) ret = (1ll * ret * a) % P;
    a = (1ll * a * a) % P;
    b >>= 1;
  }
  return ret;
}
int main() {
  scanf("%d%d", &n, &m);
  if (m == 0) {
    printf("%d\n", power(26, n));
    return 0;
  }
  scanf("%s", b + 1);
  len = strlen(b + 1);
  for (int i = 1; i <= m; ++i)
    scanf("%d", &t[i].first), t[i].second = t[i].first + len - 1;
  sort(t + 1, t + m + 1);
  for (int i = 2; i <= len; ++i) {
    while (tmp && b[tmp + 1] != b[i]) tmp = nxt[tmp];
    if (b[tmp + 1] == b[i]) tmp++;
    nxt[i] = tmp;
  }
  int k = nxt[len];
  while (k > 0) vis[k] = true, k = nxt[k];
  ans = len;
  for (int i = 1; i <= m - 1; ++i) {
    if (t[i].second < t[i + 1].first) {
      ans += len;
      continue;
    }
    int gap = t[i].second - t[i + 1].first + 1;
    if (vis[gap])
      ans += len - gap;
    else
      return puts("0"), 0;
  }
  printf("%d\n", power(26, n - ans));
  return 0;
}
