#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T bigmod(T p, T e, T M) {
  long long int ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return (T)ret;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T modinverse(T a, T M) {
  return bigmod(a, M - 2, M);
}
template <class T>
inline T bpow(T p, T e) {
  long long int ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p);
    p = (p * p);
  }
  return (T)ret;
}
int toInt(string s) {
  int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
int toLlint(string s) {
  long long int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
int n, m, ln;
char a[1000006];
int za[1000006];
void Z_algo() {
  int lt, rt, i;
  lt = 0;
  rt = 0;
  za[0] = ln;
  for (i = 1; i < ln; i++) {
    if (i < rt && za[i - lt] < rt - i + 1)
      za[i] = za[i - lt];
    else {
      if (i < rt)
        za[i] = rt - i + 1;
      else
        za[i] = 0;
      for (; i + za[i] < ln; za[i]++) {
        if (a[za[i]] != a[i + za[i]]) break;
      }
      lt = i;
      rt = i + za[i] - 1;
    }
  }
}
int main() {
  int t, i, j, k, x, ls;
  long long int q;
  scanf("%d%d", &n, &m);
  q = (long long int)n;
  scanf(" %s", a);
  ln = strlen(a);
  Z_algo();
  x = 0;
  ls = 0;
  for (i = 0; i < m; i++) {
    scanf("%d", &j);
    if (j + ln - 1 > n) {
      printf("0");
      return 0;
    }
    if (ls < j) {
      q -= ln;
      x = j;
      ls = j + ln - 1;
    } else {
      k = j - x;
      if (za[k] + k != ln) {
        printf("0");
        return 0;
      }
      x = j;
      q -= ((j + ln - 1) - ls);
      ls = j + ln - 1;
    }
  }
  printf("%lld\n", bigmod(26LL, q, 1000000007LL));
  return 0;
}
