#include <bits/stdc++.h>
using namespace std;
void imprimirVector(vector<long long> v) {
  if (!v.empty()) {
    int p = v.size();
    cout << "[";
    for (int i = 0; i < (int)(p - 1); i++) cout << v[i] << ",";
    cout << v[p - 1] << "]" << endl;
  } else
    cout << "[]" << endl;
}
int toNumber(string s) {
  int Number;
  if (!(istringstream(s) >> Number)) Number = 0;
  return Number;
}
string toString(int number) {
  ostringstream ostr;
  ostr << number;
  return ostr.str();
}
bool sePuede(vector<long long> &s, long long k, long long c) {
  long long n = s.size();
  vector<long long> capacidades(k, 0);
  long long j = 0;
  long long menor = 0;
  long long mayor = n - 1;
  vector<bool> yaPuse(n, false);
  while (menor < mayor) {
    while (mayor > menor && s[menor] + s[mayor] > c) {
      mayor--;
    }
    if (mayor > menor) {
      capacidades[j] += (s[menor] + s[mayor]);
      yaPuse[menor] = true;
      yaPuse[mayor] = true;
      menor++;
      mayor--;
      j++;
    } else
      break;
  }
  long long i = 0;
  while (i < n && j < k) {
    if (!yaPuse[i] && capacidades[j] + s[i] <= c) {
      capacidades[j] += s[i];
      yaPuse[i] = true;
      j++;
    }
    i++;
  }
  bool tutti = true;
  for (int p = 0; p < (int)(n); p++) tutti &= yaPuse[p];
  if (tutti)
    return true;
  else
    return false;
}
int main() {
  ios_base::sync_with_stdio(0);
  long long n, k;
  cin >> n >> k;
  vector<long long> s(n);
  long long cinf = 0;
  long long csup = 0;
  for (int i = 0; i < (int)(n); i++) {
    cin >> s[i];
    csup += s[i];
    cinf = max(cinf, s[i]);
  }
  cinf -= 1;
  while (csup - cinf > 1) {
    long long c = (cinf + csup) / 2;
    if (sePuede(s, k, c))
      csup = c;
    else
      cinf = c;
  }
  cout << csup << endl;
  return 0;
}
