from itertools import * from bisect import * N, M, K = map(int, input().split()) A = list(map(int, input().split())) X, Y = [], [] for i in range(K//2 + 1): for t in product(A, repeat=i): X.append(sum(t)) for i in range(K - K//2 + 1): for t in product(A, repeat=i): Y.append(sum(t)) Y.sort() ans = 0 for x in X: ind = bisect_right(Y, M - x) if ind == 0: continue ans = max(ans, x + Y[ind - 1]) print(ans)