#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int k;
  cin >> n >> k;
  vector<int> s(n);
  for (int i = 0; i < n; ++i) {
    cin >> s[i];
  }
  int delta = 2 * k - n;
  sort(s.begin(), s.end());
  int max = s[n - 1];
  int endP = 2 * n - 2 * k;
  int beginP = 0;
  for (int i = 0; i < endP; ++i) {
    if (max < s[i] + s[endP - 1 - i]) {
      max = s[i] + s[endP - 1 - i];
    }
  }
  cout << max;
  return 0;
}
