#include <bits/stdc++.h>
using namespace std;
long long binPow(long long a, long long b) {
  a = a % 1000000007;
  if (a == 0) return 0;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % 1000000007;
    a = (a * a) % 1000000007;
    b >>= 1;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  string p;
  cin >> p;
  int size = p.size();
  int PI[size];
  PI[0] = 0;
  for (int i = 1; i < size; i++) {
    int j = PI[i - 1];
    while (j > 0 && p[i] != p[j]) j = PI[j - 1];
    if (p[i] == p[j]) j++;
    PI[i] = j;
  }
  unordered_map<int, int> make_pair;
  int j = PI[size - 1];
  while (j > 0) {
    make_pair[j]++;
    j = PI[j - 1];
  }
  int y;
  int last = 1;
  long long count = 0;
  for (int i = 0; i < m; i++) {
    cin >> y;
    if (y < last) {
      if (make_pair[last - y] == 0) {
        cout << 0 << "\n";
        return 0;
      }
    } else {
      count += y - last;
    }
    last = min(n + 1, y + size);
  }
  count += max(0, n + 1 - last);
  cout << binPow(26, count) << "\n";
  return 0;
}
