#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  vector<int> arr(n);
  for (int i = 0; i < n; ++i) scanf("%d", &arr[i]);
  sort(arr.begin(), arr.end());
  int ans = 0;
  while (((int)arr.size())) {
    if (((int)arr.size()) & 1) {
      ans = max(ans, arr.back());
      arr.pop_back();
      k--;
      continue;
    }
    int can = k - ((int)arr.size()) / 2;
    if (can) {
      k--;
      ans = max(ans, arr.back());
      arr.pop_back();
      continue;
    }
    break;
  }
  for (int i = 0; i < ((int)arr.size()) / 2; ++i)
    ans = max(ans, arr[i] + arr[((int)arr.size()) - i - 1]);
  printf("%d\n", ans);
  return 0;
}
