#include <bits/stdc++.h>
using namespace std;
int v[100010];
int n, k;
int vezi(int sum) {
  if (v[n - 1] > sum) return k + 5;
  int l = 0;
  int i, j;
  i = 0;
  j = n - 1;
  while (i < j) {
    if (v[i] + v[j] > sum) {
      j--;
    } else {
      j--;
      i++;
    }
    l++;
  }
  if (i == j) l++;
  return l;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> v[i];
  int lo, hi, mid;
  lo = v[n - 1] - 7;
  hi = 2000010;
  while (hi - lo > 1) {
    mid = (hi + lo) >> 1;
    if (vezi(mid) <= k)
      hi = mid;
    else
      lo = mid;
  }
  cout << hi;
  return 0;
}
