#include <bits/stdc++.h>
using namespace std;
long long Set(long long N, long long pos) { return N = N | (1 << pos); }
long long reset(long long N, long long pos) { return N = N & ~(1 << pos); }
bool check(long long N, long long pos) { return (bool)(N & (1 << pos)); }
void CI(long long &_x) { scanf("%d", &_x); }
void CO(long long &_x) { cout << _x; }
template <typename T>
void getarray(T a[], long long n) {
  for (long long i = 0; i < n; i++) cin >> a[i];
}
template <typename T>
void prLLIarray(T a[], long long n) {
  for (long long i = 0; i < n - 1; i++) cout << a[i] << " ";
  cout << a[n - 1] << endl;
}
const double EPS = 1e-9;
const long long INF = 0x7f7f7f7f;
long long dr8[8] = {1, -1, 0, 0, 1, -1, -1, 1};
long long dc8[8] = {0, 0, -1, 1, 1, 1, -1, -1};
long long dr4[4] = {0, 0, 1, -1};
long long dc4[4] = {-1, 1, 0, 0};
long long kn8r[8] = {1, 2, 2, 1, -1, -2, -2, -1};
long long kn8c[8] = {2, 1, -1, -2, -2, -1, 1, 2};
long long F[10000000];
void build_failure_function(string pattern) {
  long long m = pattern.size();
  F[0] = F[1] = 0;
  for (long long i = 2; i <= m; i++) {
    long long j = F[i - 1];
    for (;;) {
      if (pattern[j] == pattern[i - 1]) {
        F[i] = j + 1;
        break;
      }
      if (j == 0) {
        F[i] = 0;
        break;
      }
      j = F[j];
    }
  }
}
int main() {
  long long n, m;
  cin >> n >> m;
  string pattern;
  cin >> pattern;
  long long sz = pattern.size();
  build_failure_function(pattern);
  int len = sz;
  map<int, int> M;
  while (F[len]) {
    M[F[len]] = 1;
    len = F[len];
  }
  vector<long long> pos;
  for (long long i = 0; i < m; i++) {
    long long temp;
    cin >> temp;
    pos.push_back(temp);
  }
  long long ans = 1;
  if (m == 0) {
    for (long long i = 0; i < n; i++) ans = (ans * 26) % 1000000007;
    cout << ans << "\n";
    return 0;
  }
  long long space;
  space = pos[0] - 1;
  for (long long i = 1; i < m; i++) {
    long long last_end = pos[i - 1] + sz - 1;
    if (last_end > n) {
      cout << "0\n";
      return 0;
    }
    if (last_end >= pos[i]) {
      long long mill = last_end - pos[i] + 1;
      if (M[mill]) {
      } else {
        puts("0");
        return 0;
      }
    }
    if (pos[i] > last_end) {
      space += pos[i] - last_end - 1;
    }
  }
  if (pos[m - 1] + sz - 1 > n) {
    puts("0");
    return 0;
  }
  space += n - (pos[m - 1] + sz - 1);
  for (long long i = 1; i <= space; i++) {
    ans = (ans * 26ll) % 1000000007;
  }
  cout << ans << "\n";
}
