#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
vector<long long int> z_function(string s) {
  long long int n = s.length();
  vector<long long int> z(n);
  for (long long int i = 1, l = 0, r = 0; i < n; i++) {
    if (i <= r) z[i] = min(z[i - l], r - i + 1);
    while (i + z[i] < n && s[z[i]] == s[i + z[i]]) z[i]++;
    if (z[i] + i > r) {
      l = i;
      r = i + z[i] - 1;
    }
  }
  return z;
}
long long int binpow(long long int a, long long int b) {
  long long int ans = 1;
  while (b > 0) {
    if (b & 1) ans = (ans * a) % mod;
    a = (a * a) % mod;
    b = b >> 1;
  }
  return ans;
}
signed main() {
  long long int n, m;
  cin >> n >> m;
  string p;
  cin >> p;
  vector<long long int> z = z_function(p);
  vector<long long int> y(m);
  for (long long int i = 0; i < m; ++i) cin >> y[i];
  long long int cnt = 0;
  long long int l = 0;
  long long int r = 0;
  for (long long int i = 0; i < m; ++i) {
    if (y[i] > r) {
      cnt += y[i] - r - 1;
      l = y[i];
      r = y[i] + p.length() - 1;
    } else if (l <= y[i] && r >= y[i]) {
      if (z[y[i] - l] >= r - y[i] + 1) {
        l = y[i];
        r = y[i] + p.length() - 1;
      } else {
        cout << "0";
        return 0;
      }
    }
  }
  cnt += n - r;
  long long int ans = binpow(26, cnt);
  cout << ans << "\n";
  return 0;
}
