N,K,Q = map(int,input().split())
A = tuple(map(int,input().split()))
B = sorted(A)
L = sorted([[i,B[i+Q-1] - B[i]] for i in range(N-Q+1)],key=lambda x:x[1])
print(A)
print(B)
print(L)

if Q == 1:
    print(0)
    exit()
if Q == N - K + 1:
    print(B[Q-1] - B[0])
    exit()
if K == 1:
    print(L[0])
    exit()
print(B[Q-1] - B[0])
