eolymp
bolt
Try our new interface for solving problems
Problems

Yandex

Yandex

Yandex works for one famous company. The work is not too difficult, but it takes much time. Mainly Yandex has to look for one data in one book and write it to other. Yandex is not interested, if anybody needs the results, the main is that the work is well-paid. Yandex has come to this company not long ago, so he works hard and becomes very tired to the end of the day. To the end of the day he sees all the numbers and words in the book merged into one long line, so all this valuable data is a boring string, but he has to work and work with it... The boss will probably see, how hard Yandex works and will give him a promotion... But, while Yandex was dreaming, he had forgotten, what he had to look for in the first book. After having a cup of "Lipton" tea, he remembered something. First, he remembered that he had to look for the string in the first book. Second, he remembered all the positions where this string occurred. \InputFile The input will consist of several test cases. The description of each test case will start with one integer \textbf{N} (\textbf{1} ≤ \textbf{N} ≤ \textbf{1000000}) - the number of symbols in the first book and \textbf{K} (\textbf{1} ≤ \textbf{K} ≤ \textbf{N}) - the number of positions Yandex remembered. On the second line the text from the first book - a string of characters with ASCII codes more, than \textbf{64} - will be written. The third string will contain \textbf{K} numbers of positions. The test with \textbf{N=K=0} and all the input file after this test should not be proceeded. \OutputFile For each test case, if there is such a substring, which occurs in and only in that positions, which Yandex remembered, output one string "\textbf{Correct. Length = x..y.}" (without quotes), where \textbf{x} and \textbf{y} are the minimal and maximal possible lengths of the required substring. If no solution exists, output "\textbf{Mistake.}" (also without quotes).
Time limit 1 second
Memory limit 64 MiB
Input example #1
5 2
ababa
1 3
0 0
Output example #1
Correct. Length = 2..3.