#include <bits/stdc++.h>
using namespace std;
string str, ttt;
int sz, arr[1 << 20], n, Free, fail[1 << 20], L;
bool is[1 << 20];
int main() {
  cin >> L >> n;
  str += '#';
  cin >> ttt;
  str += ttt;
  sz = str.length() - 1;
  fail[1] = 0;
  for (int j = 2; j <= sz; j++) {
    int i = fail[j - 1];
    while (1) {
      if (str[i + 1] == str[j]) {
        fail[j] = i + 1;
        break;
      }
      if (!i) break;
      i = fail[i];
    }
  }
  for (int j = fail[sz]; j != 0; j = fail[j]) is[j] = 1;
  for (int j = 1; j <= n; j++) cin >> arr[j];
  for (int j = 1; j < n; j++) {
    if (arr[j] + sz - 1 < arr[j + 1]) continue;
    if (!is[arr[j] + sz - arr[j + 1]]) {
      puts("0");
      return 0;
    }
  }
  arr[n + 1] = L + 1;
  for (int j = 2; j <= n + 1; j++) Free += max(0, arr[j] - (arr[j - 1] + sz));
  Free += arr[1] - 1;
  long long ans = 1;
  while (Free--) {
    ans *= 26;
    ans %= 1000000007;
  }
  cout << ans << endl;
}
