#include <bits/stdc++.h>
using namespace std;
int chh;
const long long N = 100005, INF = 1000000000000000LL;
long long n, m, e;
long long a[N], b[N], c[N], d[N], f[N], g[N];
void add(long long a[], long long x, long long y) {
  while (x > 0) {
    a[x] += y;
    x -= ((x) & (-(x)));
  }
}
long long cal(long long a[], long long x) {
  long long res = 0;
  while (x <= n) {
    res += a[x];
    x += ((x) & (-(x)));
  }
  return res;
}
long long solve(long long mid) {
  long long i, x, res, tmp;
  tmp = mid, res = 0;
  copy(f + 1, f + n + 1, a + 1);
  for (i = 1; i <= n; i++) {
    x = lower_bound(b + 1, b + e + 1, tmp) - b;
    res += cal(a, x), tmp += c[i];
    add(a, g[i], -1);
  }
  return res;
}
int main() {
  long long i, j, k, l, r, x;
  long long mid;
  while (scanf("%I64d %I64d", &n, &m) != EOF) {
    d[0] = 0;
    for (i = 1; i <= n; i++) {
      scanf("%I64d", &c[i]);
      d[i] = d[i - 1] + c[i];
    }
    mid = 0;
    for (i = 1; i <= n; i++) {
      for (j = i; j <= n; j++) {
        x = 0;
        for (k = i; k <= j; k++) x += c[k];
        if (x >= 5) mid++;
      }
    }
    copy(d + 1, d + n + 1, b + 1);
    sort(b + 1, b + n + 1);
    e = unique(b + 1, b + n + 1) - (b + 1);
    fill(f + 1, f + n + 1, 0);
    for (i = 1; i <= n; i++) {
      x = lower_bound(b + 1, b + e + 1, d[i]) - b;
      g[i] = x;
      add(f, x, 1);
    }
    l = -INF, r = INF;
    while (l != r) {
      mid = (l + r + 1) >> 1LL;
      if (solve(mid) >= m)
        l = mid;
      else
        r = mid - 1;
    }
    printf("%I64d\n", l);
  }
  return 0;
}
