5254: Tavas and Malekas

内存限制:256 MB 时间限制:2 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:2 通过:2

题目描述

D. Tavas and Malekas
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output



塔瓦斯是一种奇怪的生物。通常“zzz”在睡觉时从人们的嘴里发出,但长度为n的字符串则从塔瓦斯的嘴里发出。
今天塔瓦斯在马莱卡斯家睡着了。当他睡觉时,Malekas在s上做了一个小程序。Malekas有一个最喜欢的字符串p。他确定了所有位置x1<x2<<xk,其中p与s匹配。更正式地说,对于每个xi(1≤i≤k),条件sxisxi+1…sxi+|p|-1=p被完全填充。
然后Malekas写下x1,x2,…的一个子序列,。。。xk(可能,他什么都没写)在一张纸上。这里,序列b是序列a的子序列,当且仅当我们可以通过移除a的一些元素(可能没有一个元素或全部元素)将a变成b。
塔瓦斯醒来后,马莱卡斯把一切都告诉了他。他记不住字符串s,但他知道p和s都只包含小写英文字母,而且他还有他在那张纸上写的子序列。
塔瓦斯想知道,s的可能值有多少?他问萨达斯,但他不够聪明,无法解决这个问题。塔瓦斯让你帮他计算这个数字。
答案可能非常大,所以Tavas希望您以1e9+7的模打印答案。

输入
第一行包含两个整数n和m,s的长度和Malekas写下的子序列的长度(1≤n≤106和0≤m≤n-|p|+1)。
第二行包含字符串p(1≤|p|≤n)。
下一行包含m个空格分隔的整数y1,y2,。。。,ym,Malekas子序列(1≤y1<y2<…<ym≤n-|p|+1)。
输出
在单行中,以1000000007为模打印答案。
提示
在第一个样本测试中,所有形式为“ioioi?”的字符串,其中问号替换任意的英文字母。
这里|x|表示字符串x的长度。
请注意,可能没有这样的字符串(答案为0)。

Tavas is a strange creature. Usually "zzz" comes out of people's mouth while sleeping, but string s of length n comes out from Tavas' mouth instead.

Today Tavas fell asleep in Malekas' place. While he was sleeping, Malekas did a little process on s. Malekas has a favorite string p. He determined all positions x1<x2<...<xk where p matches s. More formally, for each xi (1≤ik) he condition sxisxi+1... sxi+|p|-1=p is fullfilled.
Then Malekas wrote down one of subsequences of x1,x2,... xk (possibly, he didn't write anything) on a piece of paper. Here a sequence b is a subsequence of sequence a if and only if we can turn a into b by removing some of its elements (maybe no one of them or all).
After Tavas woke up, Malekas told him everything. He couldn't remember string s, but he knew that both p and s only contains lowercase English letters and also he had the subsequence he had written on that piece of paper.
Tavas wonders, what is the number of possible values of s? He asked SaDDas, but he wasn't smart enough to solve this. So, Tavas asked you to calculate this number for him.
Answer can be very large, so Tavas wants you to print the answer modulo 109+7.
Input
The first line contains two integers n and m, the length of s and the length of the subsequence Malekas wrote down (1≤n≤106 and 0≤mn-|p|+1).
The second line contains string p (1≤|p|≤n).
The next line contains m space separated integers y1,y2,...,ym, Malekas' subsequence (1≤y1<y2<...<ymn-|p|+1).
Output
In a single line print the answer modulo 1000000007.
Examples
Input
6 2
ioi
1 3
Output
26
Input
5 2
ioi
1 2
Output
0
Note
In the first sample test all strings of form "ioioi?" where the question mark replaces arbitrary English letter satisfy.
Here |x| denotes the length of string x.
Please note that it's possible that there is no such string (answer is 0).

输入格式

输出格式

输入样例 复制


输出样例 复制


数据范围与提示