#include <bits/stdc++.h>
using namespace std;
long long bin_pow(long long a, long long b, long long mod) {
  if (b == 0) {
    return 1;
  } else if (b % 2 == 0) {
    long long t = bin_pow(a, b / 2, mod);
    return t * t % mod;
  } else {
    long long t = bin_pow(a, b - 1, mod);
    return t * a % mod;
  }
}
vector<int> z(string s) {
  int n = (int)s.length();
  vector<int> z(n);
  for (int i = 1, l = 0, r = 0; i < n; i++) {
    if (i <= r) {
      z[i] = min(r - i + 1, z[i - l]);
    }
    while (i + z[i] < n && s[z[i]] == s[i + z[i]]) {
      z[i]++;
    }
    if (i + z[i] - 1 > r) {
      l = i;
      r = i + z[i] - 1;
    }
  }
  return z;
}
void bad() {
  cout << 0 << endl;
  exit(0);
}
int main() {
  int n, m;
  cin >> n >> m;
  if (m == 0) {
    cout << bin_pow(26, n, 1000000007) << endl;
    return 0;
  }
  string p;
  cin >> p;
  vector<int> z_fun = z(p + "#" + p);
  int a = -1;
  int ans = 0;
  for (int i = 0; i < m; i++) {
    int b;
    cin >> b;
    if (a != -1) {
      int c = b - a;
      if (c < p.length()) {
        if (z_fun[p.length() + 1 + c] != p.length() - c) {
          bad();
        }
      } else {
        ans += c - p.length();
      }
    } else {
      ans += b - 1;
    }
    a = b;
  }
  int lst = a + p.length() - 1;
  if (lst > n) {
    bad();
  } else {
    ans += n - lst;
  }
  cout << bin_pow(26, ans, 1000000007) << endl;
}
