#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  int s[100005];
  while (cin >> n >> k) {
    for (int i = 0; i < n; i++) {
      cin >> s[i];
    }
    sort(s, s + n);
    if (k >= n) {
      cout << s[n - 1] << endl;
      continue;
    }
    k = n - k;
    int maxs = -1;
    for (int i = 0; i < k; i++) {
      maxs = max(maxs, s[i] + s[k * 2 - i - 1]);
    }
    int res = max(maxs, s[n - 1]);
    cout << res << endl;
  }
  return 0;
}
