#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 10;
const long long int INF = 2e18 + 10;
const int Mod = 1e9 + 7;
const int MAXN = 1e6 + 10;
const int N = 2e3 + 10;
const int M = 1e3 + 10;
int n, w, prefix[MAXN];
long long int power(long long int x, long long int y) {
  long long int ans = 1, temp = x;
  while (y) {
    if (y & 1) ans = (1ll * ans * temp) % Mod;
    temp = (1ll * temp * temp) % Mod;
    y /= 2;
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  string s;
  cin >> s;
  int b[m + 1];
  for (int i = 1; i <= m; i++) cin >> b[i];
  if (m == 0) {
    long long int ans = power(26, n);
    cout << ans << endl;
    return 0;
  }
  prefix[0] = 0;
  for (int i = 1; i < s.size(); i++) {
    int j = prefix[i - 1];
    while (j > 0 && s[i] != s[j]) j = prefix[j - 1];
    if (s[i] == s[j]) j++;
    prefix[i] = j;
  }
  int p = s.size(), cnt = p;
  for (int i = 2; i <= m; i++) {
    int l = b[i - 1], r = l + p - 1;
    if (b[i] > r) {
      cnt += p;
      continue;
    }
    int y = r - b[i] + 1;
    int j = prefix[p - 1];
    while (j > y) j = prefix[j - 1];
    if (j < y) {
      cout << "0" << endl;
      return 0;
    } else if (j == y)
      cnt = cnt + p - y;
  }
  long long int ans = power(26, n - cnt);
  cout << ans << endl;
  return 0;
}
