from itertools import permutations
def solution(r, k, m, n):
cnt, temp, bag = -1, 0, 0
for i in range(k):
while temp <= m:
cnt = (cnt + 1) % n
temp += r[cnt]
temp -= r[cnt]
cnt -= 1
bag += temp
temp = 0
return bag
N, M, K = map(int, input().split())
box = list(map(int, input().split()))
rails = list(permutations(box))
ans = []
for r in rails:
ans.append(solution(r, K, M, N))
print(min(ans))
brute force
permutation