import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def Manacher(S): L = len(S) R = [0] * L i = 0; j = 0 while i < L: while (i >= j) and (i + j < L) and (S[i-j] == S[i+j]): j += 1 R[i] = j k = 1 while (i >= k) and (i + k < L) and (k + R[i-k] < j): R[i + k] = R[i - k] k += 1 i += k j -= k return R N,K,Q = map(int, readline().split()) S = readline().rstrip() A = map(int, read().split()) M = Manacher(S*3) for x in A: x -= 1 nl = x + 1 nr = N * K - x q, r = divmod(x, N) l = M[N + r] if l in [N + r + 1, 2 * N - r]: n = min(nl, nr) print(2 * n - 1) else: print(2 * min(l, nl, nr) - 1)