#include <bits/stdc++.h>
const int MOD = 1000000007;
int64_t mod_pow(int64_t a, int64_t b) {
  if (b == 0)
    return 1;
  else if (b % 2 == 0)
    return mod_pow(a * a % MOD, b >> 1);
  else
    return a * mod_pow(a, b - 1) % MOD;
}
std::vector<int> z_algo(const std::string& s) {
  const int n = s.length();
  std::vector<int> z(n, 0);
  int L = 0, R = 0;
  for (int i = 1; i < n; i++) {
    if (i > R) {
      L = R = i;
      while (R < n && s[R - L] == s[R]) R++;
      z[i] = R - L;
      R--;
    } else {
      int k = i - L;
      if (z[k] < R - i + 1)
        z[i] = z[k];
      else {
        L = i;
        while (R < n && s[R - L] == s[R]) R++;
        z[i] = R - L;
        R--;
      }
    }
  }
  return z;
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n, m;
  std::cin >> n >> m;
  std::string p;
  std::cin >> p;
  if (m == 0) {
    std::cout << mod_pow(26, n) << '\n';
    return 0;
  }
  if (m == 1) {
    std::cout << mod_pow(26, n - p.length()) << '\n';
    return 0;
  }
  auto z = z_algo(p);
  std::set<int> xs;
  int x;
  std::cin >> x;
  xs.insert(x);
  int free_spots = n - p.length();
  bool ok = true;
  for (int i = 1; i < m; ++i) {
    std::cin >> x;
    if (ok) {
      int px = *xs.rbegin();
      xs.insert(x);
      if (x - px < z.size() && z[x - px] != p.length() - x + px) {
        ok = false;
        continue;
      }
      const int inter = std::max(0, int(p.length()) - x + px);
      free_spots -= (p.length() - inter);
    }
  }
  if (ok) {
    std::cout << mod_pow(26, free_spots) << '\n';
  } else {
    std::cout << 0 << '\n';
  }
  return 0;
}
