#include <bits/stdc++.h>
using namespace std;
long long int i, j, k;
const int N = 200 * 1000 + 9;
void solve() {
  long long int n;
  cin >> n;
  long long int k;
  cin >> k;
  vector<long long int> v(n);
  for (i = 0; i < n; i++) cin >> v[i];
  long long int x = n / k;
  long long int y = n % k;
  if (x == 1 and y == 0) {
    cout << v[n - 1] << '\n';
    return;
  }
  if (x == 2 and y == 0) {
    i = 0;
    j = n - 1;
    long long int mx = 0;
    while (i < j and i < n and j > 0) {
      long long int sum = v[i] + v[j];
      if (sum > mx) mx = sum;
      i++;
      j--;
    }
    cout << mx << '\n';
    return;
  }
  if (k >= n) {
    cout << v[n - 1] << '\n';
    return;
  }
  long long int no = 2 * y;
  i = 0;
  j = no - 1;
  long long int mx = 0;
  while (i < j and i < n and j > 0) {
    long long int sum = v[i] + v[j];
    mx = max(sum, mx);
    i++;
    j--;
  }
  while (i < n) {
    mx = max(mx, v[i]);
    i++;
  }
  cout << mx << '\n';
  return;
}
signed main() {
  solve();
  return 0;
}
