Repair
Stepan recently purchased a new apartment and decided to apply wallpaper before his parents visit. Initially, it seemed straightforward, but he encountered a challenge when he realized he needed to align the patterns on adjacent strips of wallpaper. Being a skilled programmer, Stepan framed the problem as follows: Each strip of wallpaper can be represented by a section—a rectangle with a height of N and a width of M. This rectangle can be repeated to the right and left to form the complete strip. For simplicity, imagine dividing this rectangle into equal cells, creating N rows and M columns. The wallpaper pattern is represented using the symbols "." and "*" (dot and asterisk), with one symbol per cell.
You are provided with the descriptions of two wallpaper strips. Your task is to assist Stepan by writing a program that calculates the minimum number of cells the second strip must be shifted to the right to align its pattern with the first strip. The wallpaper is designed such that alignment is always possible.
Input
The first line of the input contains two integers N and M (1 ≤ N ≤ 20, 1 ≤ M ≤ 100000). The following N lines each contain M characters, describing the first strip of wallpaper. The next N lines each contain M characters, describing the second strip of wallpaper. Each line in the wallpaper description consists solely of the symbols "." and "*".
Output
The output should be a single number—the minimum number of cells the second strip needs to be shifted to the right to match the pattern on the first strip.