#include <bits/stdc++.h>
using namespace std;
long long s[100050], x[100050], y[100050];
long long val;
long long solve(int l, int r) {
  if (l == r) {
    x[l] = s[l];
    return 0;
  }
  int m = (l + r) >> 1;
  long long ret = solve(l, m) + solve(m + 1, r);
  for (int i = l, j = m + 1; i <= m; i++) {
    while (j <= r && x[j] - x[i] <= val) j++;
    ret += r - j + 1;
  }
  memcpy(y + l, x + l, (r - l + 1) * sizeof(long long));
  merge(y + l, y + m + 1, y + m + 1, y + r + 1, x + l);
  return ret;
}
int main() {
  int n;
  long long k;
  scanf("%d%I64d", &n, &k);
  memset(s, 0, sizeof(s));
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &s[i]);
    s[i] += s[i - 1];
  }
  long long l = -1000000000000000LL, r = 1000000000000000LL;
  while (l + 1 < r) {
    long long mid = (l + r) >> 1;
    val = mid;
    if (solve(0, n) >= k) {
      l = mid;
    } else {
      r = mid;
    }
  }
  printf("%I64d\n", l + 1);
  return 0;
}
