#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int n, k, s[N];
int main() {
  while (cin >> n >> k) {
    for (int i = 1; i <= n; i++) {
      cin >> s[i];
    }
    if (n <= k)
      cout << s[n] << endl;
    else {
      int ans = s[n], j = n - k + 1;
      for (int i = n - k; i >= 1; i--) {
        ans = max(ans, s[i] + s[j++]);
      }
      cout << ans << endl;
    }
  }
  return 0;
}
