N,M,K = map(int,input().split()) A = list(map(int,input().split())) A.sort() from bisect import bisect B = set() for a in A: for b in A: B.add(a+b) B = sorted(B) C = set() for a in A: for b in A: for c in A: C.add(a+b+c) C = sorted(C) ans = 0 if K >= 1: i = bisect(A, M) if i: ans = max(ans, A[i-1]) if K >= 2: i = bisect(B, M) if i: ans = max(ans, B[i-1]) if K >= 3: i = bisect(C, M) if i: ans = max(ans, C[i-1]) if K >= 4: for b in B: i = bisect(B, M-b) if i: ans = max(ans, b + B[i-1]) if K >= 5: for b in B: i = bisect(C, M-b) if i: ans = max(ans, b + C[i-1]) if K >= 6: for c in C: i = bisect(C, M-c) if i: ans = max(ans, c + C[i-1]) print(ans)