#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
const int mod = 1e9 + 7;
vector<int> zet(string second) {
  int n = second.size();
  vector<int> z(n, 0);
  for (int j = 0, i = 1; i < n; ++i) {
    if (z[j] + j > i) z[i] = min(z[j] + j - i, z[i - j]);
    while (z[i] + i < n && second[z[i]] == second[z[i] + i]) z[i]++;
    if (z[i] + i > z[j] + j) j = i;
  }
  return z;
}
int bin_pow(int a, int n) {
  if (n == 0) return 1;
  if (n == 1) return a;
  int res;
  if (n & 1)
    res = (bin_pow(a, n - 1) * 1ll * a) % mod;
  else {
    res = bin_pow(a, n >> 1);
    res = (res * 1ll * res) % mod;
  }
  return res;
}
int n, m, can[N], x[N];
string p;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n >> m;
  cin >> p;
  for (int i = 1; i <= m; ++i) cin >> x[i];
  vector<int> z = zet(p);
  for (int i = 0; i < z.size(); ++i)
    if (z[i] == p.size() - i) can[i] = 1;
  int ans = 1;
  for (int i = 1; i <= m; ++i) {
    if (i == 1)
      ans = (ans * 1ll * bin_pow(26, x[i] - 1)) % mod;
    else {
      if (x[i] <= x[i - 1] + p.size() - 1) {
        if (!can[x[i] - x[i - 1]]) {
          cout << 0;
          return 0;
        }
      } else
        ans = (ans * 1ll * bin_pow(26, x[i] - (x[i - 1] + p.size()))) % mod;
    }
    if (i == m)
      ans = (ans * 1ll * bin_pow(26, n - (x[i] + p.size() - 1))) % mod;
  }
  if (m == 0) ans = bin_pow(26, n);
  cout << ans;
  return 0;
}
