#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
const int mod = 1e9 + 7;
char str[maxn];
int n, m, len;
int sub[maxn];
long long modpow(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) {
      ans = (ans * a) % mod;
    }
    b >>= 1;
    a = (a * a) % mod;
  }
  return ans;
}
struct KMP {
  int next[maxn];
  int nxt[maxn];
  void getNext() {
    next[0] = len;
    int pos = 0;
    while (pos + 1 < len && str[pos] == str[pos + 1]) {
      ++pos;
    }
    next[1] = pos;
    int k = 1, L;
    for (int i = 2; i < len; i++) {
      pos = k + next[k] - 1;
      L = next[i - k];
      if (i + L <= pos) {
        next[i] = L;
      } else {
        int j = pos - i + 1;
        if (j < 0) {
          j = 0;
        }
        while (i + j < len && str[i + j] == str[j]) {
          ++j;
        }
        next[i] = j;
        k = i;
      }
    }
  }
  void solve() {
    len = strlen(str);
    if (sub[m - 1] + len > n + 1) {
      printf("0\n");
      return;
    }
    getNext();
    long long ans = 0;
    if (sub[0] != 1) {
      ans = sub[0] - 1;
    }
    for (int i = 1; i < m; i++) {
      int e = sub[i] - sub[i - 1];
      if (e < len && next[e] != len - e) {
        printf("0\n");
        return;
      }
      if (e > len) {
        ans += e - len;
      }
    }
    if (sub[m - 1] + len - 1 < n) {
      ans += n - sub[m - 1] - len + 1;
    }
    printf("%lld\n", modpow(26, ans));
  }
} kmp;
int main() {
  scanf("%d%d%s", &n, &m, str);
  for (int i = 0; i < m; i++) {
    scanf("%d", &sub[i]);
  }
  if (m == 0) {
    printf("%lld\n", modpow(26, n));
    return 0;
  }
  kmp.solve();
  return 0;
}
