#include <bits/stdc++.h>
const int maxBufSize = (10000000);
using namespace std;
long long int n, m;
string p;
long long int zrr[1000005];
void zedAlgo(string s) {
  long long int i, j, k, a, b, c, len, l, r;
  len = s.length();
  zrr[0] = len;
  l = r = -1;
  for (i = 1; i <= len - 1; ++i) {
    if (r < i) {
      j = 0;
      b = i;
      while (b < len && s[j] == s[b]) {
        j++;
        b++;
      }
      l = i, r = b - 1;
      if (l <= r) {
        zrr[i] = r - l + 1;
      } else {
        zrr[i] = 0;
      }
    } else if (i <= r) {
      k = i - l;
      a = zrr[k] <= r - i + 1 ? zrr[k] : r - i + 1;
      if (a < r - i + 1) {
        zrr[i] = zrr[k];
      } else {
        b = r + 1;
        j = r - i + 1;
        while (b < len && s[b] == s[j]) {
          b++;
          j++;
        }
        r = b - 1;
        l = i;
        zrr[i] = r - l + 1;
      }
    }
  }
  return;
}
long long int power(long long int a, long long int b) {
  if (b == 0) {
    return 1;
  }
  long long int temp;
  temp = power(a, b / 2) % 1000000007;
  temp = (temp * temp) % 1000000007;
  if (b & 1) {
    temp = temp * a;
  }
  return temp % 1000000007;
}
int main() {
  long long int i, j, a, b, c, ans, poss, pre, len, r;
  cin >> n >> m;
  ans = 1;
  cin >> p;
  if (m == 0) {
    ans = power(26, n);
    cout << ans;
    return 0;
  }
  zedAlgo(p);
  poss = 1;
  len = p.length();
  a = 0;
  for (i = 1; i <= m; ++i) {
    cin >> a;
    if (i == 1) {
      b = a - 1;
      ans = (ans * power(26, b)) % 1000000007;
      pre = a;
    } else {
      if (a > pre + len - 1) {
        b = a - (pre + len);
        ans = (ans * power(26, b)) % 1000000007;
      } else {
        c = a - pre;
        if (zrr[c] < len - c) {
          poss = 0;
          break;
        }
      }
      pre = a;
    }
  }
  if (poss == 1) {
    for (i = a + len; i <= n; ++i) {
      ans = (ans * 26) % 1000000007;
    }
    cout << ans % 1000000007;
  } else {
    cout << 0;
  }
  return 0;
}
