#include <bits/stdc++.h>
using namespace std;
vector<int> V;
int ma(int n, int l) {
  if (n > l) return n;
  return l;
}
int main() {
  int m[100004], e, r, t1, t2, s1, s2, t, a1, a2, a3, a4, a5, a;
  int k, v, b, g, h, o;
  while (scanf("%d%d", &e, &r) == 2) {
    V.clear();
    for (int i = 1; i <= e; i++) scanf("%d", &m[i]);
    if (e == 1)
      a = m[1];
    else if (e == 2) {
      if (r == 1)
        a = m[1] + m[2];
      else
        a = m[2];
    } else {
      if (r >= e)
        a = m[e];
      else {
        t = e - r;
        a2 = 2 * t;
        for (int i = 1; i <= t; i++) {
          V.push_back(m[i] + m[a2]);
          a2--;
        }
        V.push_back(m[e]);
        sort(V.begin(), V.end());
        a = V[V.size() - 1];
      }
    }
    printf("%d\n", a);
  }
}
