Byteman keeps all of his savings in an old safe. The lock of this safe consists of n identical wheels, and every wheel has the same word of m letters written around it. The wheels turn independently, so each one can be set to any of its m positions. The safe opens when, at every one of the m positions, all wheels show the same letter, that is, when all wheels display exactly the same word.
Turning any single wheel by 360/m degrees to the left or to the right takes one second. Compute the minimum total time needed to open the safe.
The first line contains two integers n and m, separated by a single space (2≤n,m≤1000000): the number of wheels in the lock and the length of the word written on each wheel.
The second line contains the word s1s2…sm of length m, consisting of uppercase English letters.
The third line contains n integers o1,o2,…,on, separated by single spaces (0≤oi<m). The value oi=k means that wheel i is rotated k positions to the left from a fixed reference position, so it currently shows sk+1sk+2…sms1s2…sk. For example, oi=0 means wheel i is not rotated at all.
Print one integer: the minimum number of seconds required to open the safe.
A left rotation and a right rotation by one position are opposite moves. Suppose a wheel currently shows the word OWIKSL. Turning it one position to the left gives WIKSLO, while turning it one position to the right gives LOWIKS. Two wheels count as aligned only when the words they display are identical, so if the word has a repeating structure, several different rotations can produce the same display.