import sys input = sys.stdin.readline from heapq import * N, K = map(int, input().split()) A = list(map(int, input().split())) pq = [] s = 0 for i in range(N-1, N-K, -1): heappush(pq, A[i]) s += A[i] ans = 0 for i in range(N-K, -1, -1): if i%2==1: ans = max(ans, A[i]+s) if pq[0]