#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 7;
long long int a[MAXN], f[MAXN];
set<long long int> st;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n, m, k = 0, t, len = 0, y, ans = 1;
  cin >> n >> m;
  string s;
  cin >> s;
  t = s.length();
  for (long long int i = 0; i < m; i++) cin >> a[i];
  for (long long int i = 1; i < t; i++) {
    while (k > 0 && s[i] != s[k]) k = f[k];
    if (s[i] == s[k]) k++;
    f[i + 1] = k;
  }
  k = t;
  while (k > 0) {
    k = f[k];
    if (k != 0) st.insert(k);
  }
  if (m != 0) len += t;
  for (long long int i = 1; i < m; i++) {
    long long int x = t - (a[i] - a[i - 1]);
    if (x < 1 || a[i] == a[i - 1]) {
      len += t;
      continue;
    }
    len += (t - x);
    if (st.count(x) == 0) {
      cout << 0;
      return 0;
    }
  }
  for (long long int i = 0; i < n - len; i++) {
    ans *= 26;
    ans %= MOD;
  }
  cout << ans;
}
