#include <bits/stdc++.h>
using namespace std;
int c[1000010];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &c[i]);
  sort(c + 1, c + 1 + n);
  int ans = c[n], kt = 2 * (n - k);
  for (int i = 1; i <= n - k; i++) ans = max(ans, c[i] + c[kt - i + 1]);
  printf("%d\n", ans);
  return 0;
}
