#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > s;
const int maxn = 0x7f7f7f7f;
const int maxx = 1e6 + 10;
int a[maxx];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  if (n == k)
    cout << a[n] << endl;
  else if (n / k == 2) {
    int ans = a[n];
    for (int i = 1; i <= n / 2; i++) ans = max(ans, a[i] + a[n - i + 1]);
    cout << ans << endl;
  } else {
    int ans = a[n];
    int cnt = n % k;
    for (int i = 1; i <= cnt; i++) ans = max(ans, a[i] + a[cnt * 2 - i + 1]);
    cout << ans << endl;
  }
  return 0;
}
