#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
long long a[N], n, seg[20][N];
void build(int xl = 0, int xr = n, int ind = 0) {
  if (xr - xl == 1) {
    seg[ind][xl] = a[xr] - a[xl];
    return;
  }
  int xm = (xl + xr) / 2;
  build(xl, xm, ind + 1);
  build(xm, xr, ind + 1);
  for (int i = xl; i < xm; i++) seg[ind][i] = a[xm] - a[i];
  for (int i = xm; i < xr; i++) seg[ind][i] = a[i + 1] - a[xm];
  sort(&seg[ind][xl], &seg[ind][xm]);
  sort(&seg[ind][xm], &seg[ind][xr]);
}
inline long long GreaterThan(long long x, int xl = 0, int xr = n, int k = 1,
                             int ind = 0) {
  if (xr - xl == 1) return (seg[ind][xl] > x);
  int xm = (xl + xr) / 2;
  long long GreaterChild = GreaterThan(x, xl, xm, 2 * k, ind + 1) +
                           GreaterThan(x, xm, xr, 2 * k + 1, ind + 1);
  long long GreaterMid = 0;
  int j = xr;
  for (int i = xl; i < xm; i++) {
    while (j > xm && seg[ind][j - 1] + seg[ind][i] > x) j--;
    GreaterMid += xr - j;
  }
  return GreaterChild + GreaterMid;
}
int main() {
  ios::sync_with_stdio(0);
  long long k;
  scanf("%lld %lld", &n, &k);
  for (int i = 0; i < n; i++) scanf("%lld", &a[i + 1]);
  for (int i = 1; i < n; i++) a[i + 1] += a[i];
  build();
  long long l = -1e14 - 7, r = 1e14 + 7;
  while (r - l > 1) {
    long long m = (l + r) / 2;
    long long ans = GreaterThan(m);
    if (ans >= k)
      l = m;
    else
      r = m;
  }
  printf("%lld\n", r);
  return 0;
}
