#include <bits/stdc++.h>
using namespace std;
int N, K, s[100000];
bool can(int k);
int main() {
  int lo, mid, hi;
  scanf("%d %d", &N, &K);
  for (int i = 0; i < N; i++) scanf("%d", &s[i]);
  if (K >= N) {
    printf("%d\n", s[N - 1]);
    return 0;
  }
  lo = s[N - 1];
  hi = s[N - 2] + s[N - 1];
  while (lo < hi) {
    mid = (lo + hi) >> 1;
    if (can(mid))
      hi = mid;
    else
      lo = mid + 1;
  }
  printf("%d\n", hi);
  return 0;
}
bool can(int k) {
  int ans = 0, upper = N;
  for (int i = 0; i < upper; i++) {
    int temp = lower_bound(s + i + 1, s + upper, k - s[i]) - s;
    if (temp == upper) temp = upper - 1;
    while (s[temp] + s[i] > k) temp--;
    ans += upper - temp;
    upper = temp;
  }
  return ans <= K;
}
