from itertools import permutations N = int(input()) K = int(input()) n = list(int(input()) for _ in range(N)) L = [i for i in range(N)] ans = 0 for A in range(1,N+1): for B in range(1,N+1): if N - A - B < K - 2: continue for X in permutations(L, A): for Y in permutations(L, B): flg = True for x in X: if x in Y: flg = False break if flg: P = sum([n[i] for i in X]) / len(X) Q = sum([n[i] for i in Y]) / len(Y) R = int(P - Q + 0.9) ans = max(ans, R) print(ans)