#include <bits/stdc++.h>
using namespace std;
int dx4[] = {-1, 0, 1, 0};
int dy4[] = {0, 1, 0, -1};
int dx8[] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dy8[] = {0, 1, 1, 1, 0, -1, -1, -1};
void Duxar(int _this_line) {}
template <class T>
void ReadNo(T &_value) {
  T _sign = 1;
  char ch;
  _value = 0;
  while (!isdigit(ch = getchar())) {
    (ch == '-') && (_sign = -1);
  }
  do {
    _value = _value * 10 + (ch - '0');
  } while (isdigit(ch = getchar()));
  _value *= _sign;
}
int N, M;
long long hash_prefix, hash_suffix;
string S;
vector<bool> match_lg;
int RisePower(int x, int k) {
  if (k == 0) {
    return 1;
  }
  long long ans = RisePower(x, k / 2);
  ans = (ans * ans) % 1000000007;
  if (k & 1) {
    ans = (ans * x) % 1000000007;
  }
  return ans;
}
int main() {
  string file_input = "zzzzzzzz";
  int i, cnt = 0, lg, pos, last_pos;
  long long pw = 1;
  ReadNo(N);
  ReadNo(M);
  if (M) {
    cin >> S;
    lg = S.length();
    match_lg.resize(lg + 1);
    for (i = 0; i < lg - 1; ++i) {
      hash_prefix = ((hash_prefix * 91) % 1000000007 + S[i] - 'a') % 1000000007;
      hash_suffix = (hash_suffix + pw * (S[lg - i - 1] - 'a')) % 1000000007;
      match_lg[i + 1] = (hash_prefix == hash_suffix);
      pw = (pw * 91) % 1000000007;
    }
    ReadNo(pos);
    cnt += pos - 1;
    last_pos = pos + lg - 1;
    for (i = 1; i < M; ++i) {
      ReadNo(pos);
      if (pos <= last_pos) {
        if (!match_lg[last_pos - pos + 1]) {
          printf("0\n");
          return 0;
        }
      } else {
        cnt += pos - last_pos - 1;
      }
      last_pos = pos + lg - 1;
    }
    cnt += N - last_pos;
  } else {
    cnt = N;
  }
  printf("%d\n", RisePower(26, cnt));
  return 0;
}
