func_code_string: #include <bits/stdc++.h>   using namespace std;   int z[1000005];   string s;   void z_function() {     int n = (int)s.length();     for (int i = 0; i < n; i++) z[i] = 0;     for (int i = 1, l = 0, r = 0; i < n; ++i) {       if (i <= r) z[i] = min(r - i + 1, z[i - l]);       while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];       if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;     }   }   long long power(long long a, long long b, long long m) {     long long x = 1;     a %= m;     while (b) {       if ((1 & b)) x = x * a % m;       a = a * a % m;       b >>= 1;     }     return x;   }   int y[1000005];   int main() {     int n, m;     scanf( %d , &n);     scanf( %d , &m);     cin >> s;     z_function();     int p = s.length();     for (int i = 1; i <= m; i++) {       scanf( %d , &y[i]);     }     y[m + 1] = n + 1;     int pos = 0;     pos += y[1] - 1;     for (int i = 2; i <= m + 1; i++) {       if (y[i] < y[i - 1] + p) {         if (z[y[i] - y[i - 1]] < p - y[i] + y[i - 1]) {           printf( 0 );           return 0;         }       } else         pos += y[i] - y[i - 1] - p;     }     printf( %lld n , power(26, pos, 1000000007));   }   