#include <bits/stdc++.h>
using namespace std;
vector<int> PREF(string s) {
  s += '#';
  vector<int> R((int)(s).size());
  R[0] = 0;
  int i = 1, t = 0;
  while (i < (int)(s).size() - 1) {
    while (s[i + t] == s[t]) ++t;
    R[i] = t;
    int k = 1;
    while ((k < t) && (R[k] != R[i] - k)) {
      R[i + k] = (((R[k]) < (R[i] - k)) ? (R[k]) : (R[i] - k));
      ++k;
    }
    t = (((0) > (t - k)) ? (0) : (t - k));
    i += k;
  }
  R.pop_back();
  R[0] = (int)(s).size() - 1;
  return R;
}
int main() {
  ios_base::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  string p;
  cin >> p;
  int len = (int)(p).size();
  vector<int> pref = PREF(p);
  vector<bool> isMatch(len, 0);
  for (int i = (0); i <= ((int)(isMatch).size() - 1); ++i)
    isMatch[i] = (pref[i] == len - i);
  vector<int> T(m);
  for (int i = (0); i <= ((int)(T).size() - 1); ++i) cin >> T[i];
  for (int i = (0); i <= ((int)(T).size() - 1); ++i) T[i]--;
  for (int i = (0); i <= (m - 2); ++i) {
    int x1 = T[i], x2 = T[i + 1], diff = x2 - x1;
    if (diff < len && !isMatch[diff]) {
      cout << 0;
      return 0;
    }
  }
  vector<int> cnt(n, 0);
  for (int i = (0); i <= ((int)(T).size() - 1); ++i) {
    int x = T[i];
    cnt[x]++;
    if (x + len < n) cnt[x + len]--;
  }
  for (int i = (1); i <= (n - 1); ++i) cnt[i] += cnt[i - 1];
  long long int ans = 1;
  for (int i = (0); i <= ((int)(cnt).size() - 1); ++i)
    if (!cnt[i]) ans = (ans * 26) % 1000000007;
  cout << ans;
  return 0;
}
