#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> arr(n);
  for (int i = 0; i < n; ++i) scanf("%d", &arr[i]);
  sort(arr.begin(), arr.end());
  int one = 0;
  while (one < n && (k - one - 1) * 2 >= n - (one + 1)) ++one;
  int two = (n - one) / 2;
  long long ans = 0;
  for (int i = two * 2; i < n; ++i) ans = max(ans, (long long)arr[i]);
  arr.resize(two * 2);
  for (int i = 0; i < two; ++i)
    ans = max(ans, (long long)arr[i] + arr[2 * two - 1 - i]);
  cout << ans << '\n';
}
