import re, itertools, bisect n, m, q = map(int, input().split()) s = input() K = map(int, input().split()) s = re.fullmatch('(.+?)\1*', s).group(1) n, m = len(s), n//len(s)*m s *= 2 T = sorted(range(n*2), key = lambda i: s[i:]) J = [0] + list(itertools.accumulate(m-1 if t