#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[100005];
int check(int x) {
  for (int i = 1; i <= n; i++)
    if (a[i] > x) return 0;
  int ans = 0;
  int st = 1, ed = n;
  while (1) {
    if (st > ed) break;
    if (a[st] + a[ed] <= x) {
      st++, ed--;
      ans++;
    } else {
      ed--;
      ans++;
    }
  }
  if (ans <= k) return 1;
  return 0;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  int l = 1, r = 2 * 1000000;
  while (l <= r) {
    int mid = (l + r) / 2;
    if (check(mid))
      r = mid - 1;
    else
      l = mid + 1;
  }
  printf("%d\n", l);
}
