#include <bits/stdc++.h>
using namespace std;
const int maxn = 105000;
int n, k;
int size[maxn];
inline int check(int mz) {
  int tot = 0;
  for (int i = 1, j = n; i <= j; --j) {
    ++tot;
    if (i == j) break;
    if (size[i] + size[j] <= mz) ++i;
  }
  return tot <= k;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; ++i) scanf("%d", &size[i]);
  sort(size + 1, size + n + 1);
  int llim = size[n], rlim = size[n] << 1, mid;
  while (llim < rlim - 1) {
    mid = (llim + rlim) >> 1;
    if (check(mid))
      rlim = mid;
    else
      llim = mid;
  }
  if (check(llim))
    printf("%d\n", llim);
  else
    printf("%d\n", rlim);
  return 0;
}
