#include <bits/stdc++.h>
using namespace std;
vector<int> g_next;
void getg_next(string s) {
  g_next.clear();
  int len = s.size();
  int i = 1, j = 0;
  g_next.push_back(-1);
  g_next.push_back(0);
  while (i < len) {
    if (s[i++] != s[j++]) {
      j = 0;
    }
    g_next.push_back(j);
  }
  return;
}
int powMod(int x, int pow, int mod) {
  x %= mod;
  if (0 == pow) {
    return 1;
  }
  if (1 == pow) {
    return x;
  }
  unsigned long long y = powMod(x, pow >> 1, mod);
  y = (y * y) % mod;
  if (pow & 1) {
    y = (x * y) % mod;
  }
  return (int)y;
}
bool next2Num(int pos, int dst) {
  while (pos > dst) {
    pos = g_next[pos];
  }
  return pos == dst;
}
bool isPrefix(int st, int fn) {
  if (st > fn) {
    return true;
  }
  if (!next2Num(st + 1, 1)) {
    return false;
  }
  if (!next2Num(fn + 1, fn - st + 1)) {
    return false;
  }
  return true;
}
int main() {
  int n, m;
  cin >> n >> m;
  string s;
  cin >> s;
  getg_next(s);
  int t = n;
  int len = s.size();
  int fn = 0, x;
  int last = -1;
  bool flag = true;
  for (int i = 0; i < m; i++) {
    cin >> x;
    if (false == flag || !isPrefix(len - (fn - x) - 1, len - 1)) {
      flag = false;
      continue;
    }
    if (x > fn) {
      t -= len;
    } else {
      t -= (x + len - 1 - fn);
    }
    fn = x + len - 1;
    last = x;
  }
  if (true == flag) {
    t = powMod(26, t, 1000000007);
  } else {
    t = 0;
  }
  cout << t << endl;
  return 0;
}
