#include <bits/stdc++.h>
using namespace std;
long long int modpow(long long int n, long long int p) {
  long long int ans = 1;
  while (p > 0) {
    if (p & 1) ans = (ans * n) % 1000000007;
    n = (n * n) % 1000000007;
    p = p / 2;
  }
  return ans;
}
vector<long long int> z_algorithm(string p) {
  vector<long long int> z_vector;
  z_vector.push_back(-1);
  long long int l = 0, r = 0;
  for (long long int i = 1; i < p.length(); i++) {
    if (i > r) {
      l = i;
      r = i;
      while (r < p.length() && p[r - l] == p[r]) r++;
      z_vector.push_back(r - l);
      r--;
    } else {
      long long int k = i - l;
      if (z_vector[k] < r - l + 1)
        z_vector.push_back(z_vector[k]);
      else {
        l = i;
        while (r < p.length() && p[r - l] == p[r]) r++;
        z_vector.push_back(r - l);
        r--;
      }
    }
  }
  return z_vector;
}
int main() {
  long long int n, m;
  cin >> n >> m;
  string p;
  cin >> p;
  vector<long long int> z_vector = z_algorithm(p);
  long long int ans = 0;
  long long int last = 0;
  long long int flag = 0;
  while (m--) {
    long long int a;
    cin >> a;
    if (a + p.length() - 1 > n) {
      flag = 1;
      break;
    }
    if (a > last) {
      ans += a - last - 1;
      last = a + p.length() - 1;
    } else {
      long long int temp = last - a;
      temp = p.length() - temp;
      if (z_vector[temp - 1] != last - a + 1) {
        flag = 1;
        break;
      } else {
        last = last + temp - 1;
      }
    }
  }
  if (flag) {
    cout << "0";
    return 0;
  }
  if (last < n) ans += n - last;
  cout << modpow(26, ans);
}
