#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, inp;
  vector<int> v;
  cin >> n >> k;
  if (k >= n) {
    while (n--) cin >> inp;
    cout << inp;
  } else {
    for (int i = 0; i < n; i++) {
      cin >> inp;
      v.push_back(inp);
    }
    reverse(v.begin(), v.end());
    vector<int> v2;
    for (int i = 0; i < k; i++) v2.push_back(v[i]);
    reverse(v2.begin(), v2.end());
    for (int i = k, j = 0; i < n; i++, j++) v2[j] += v[i];
    int mx = INT_MIN;
    for (int i = 0; i < v2.size(); i++) mx = max(mx, v2[i]);
    cout << mx;
  }
  return 0;
}
