#include <bits/stdc++.h>
using namespace std;
int n;
int pos(int a[], int k, int mx) {
  int cnt = 0, l = 0, r = n - 1;
  while (l <= r) {
    if (a[l] + a[r] <= mx)
      l++, r--, cnt++;
    else {
      if (a[r] > mx || a[l] > mx) return 0;
      cnt++, r--;
    }
  }
  if (cnt <= k) return 1;
  return 0;
}
int bsearch(int a[], int low, int high, int k) {
  if (low <= high) {
    int mid = (low + high) / 2;
    if (pos(a, k, mid)) {
      if (!pos(a, k, mid - 1))
        return mid;
      else {
        return bsearch(a, low, mid - 1, k);
      }
    } else {
      return bsearch(a, mid + 1, high, k);
    }
  } else
    return 0;
}
int main() {
  int i, a[100004], k, mn = INT_MAX, mx = INT_MIN, t;
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    mn = min(a[i], mn);
    if (i) {
      mx = max(a[i] + a[i - 1], mx);
    } else {
      mx = a[i];
    }
  }
  int ans = bsearch(a, mn, mx, k);
  cout << ans << endl;
  return 0;
}
