#include <bits/stdc++.h>
using namespace std;
int A[100005], B[100005 / 2];
int solve(int n, int k) {
  int maxS = 0, d, i, j;
  for (i = n - 1, j = 0, d = 1; i >= 0; --i) {
    B[j] += A[i];
    if (maxS < B[j]) maxS = B[j];
    if (j == k - 1 && d == 1)
      d = -1;
    else
      j += d;
  }
  return maxS;
}
int main() {
  int n, k, i;
  scanf("%d %d", &n, &k);
  for (i = 0; i < n; ++i) scanf("%d", A + i);
  printf("%d\n", solve(n, k));
  return 0;
}
