#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n, k;
  cin >> n >> k;
  long long a[n];
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sort(a, a + n);
  long long i = 0, j = n - 1, mx = 0;
  while (i <= j) {
    if (k > (j + 1) / 2) {
      if (mx < a[j]) {
        mx = a[j];
      }
      j--;
      k--;
    } else {
      if (mx < a[i] + a[j]) {
        mx = a[i] + a[j];
      }
      i++;
      j--;
      k--;
    }
  }
  cout << mx << endl;
}
