#include <bits/stdc++.h>
using namespace std;
int a[100010];
int main() {
  int n, m;
  int mx = 0;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n - m; i++) {
    if (mx < (a[i] + a[2 * (n - m) - i + 1])) {
      mx = (a[i] + a[2 * (n - m) - i + 1]);
    }
  }
  if (mx < a[n])
    cout << a[n] << endl;
  else
    cout << mx << endl;
  return 0;
}
