#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
inline int mymax(int a, int b) { return a < b ? b : a; }
inline int mymin(int a, int b) { return a > b ? b : a; }
inline long long mymax(long long a, long long b) { return a < b ? b : a; }
inline long long mymin(long long a, long long b) { return a > b ? b : a; }
int n;
long long sum[110000];
long long tree[20][110000];
void build(int a, int b, int d) {
  for (int i = a; i < b; ++i) tree[d][i] = sum[i];
  if (b == a + 1) return;
  sort(tree[d] + a, tree[d] + b);
  int c = (a + b) / 2;
  build(a, c, d + 1);
  build(c, b, d + 1);
}
int cntless(long long v, int l, int r, int a, int b, int d) {
  if (l == a && r == b)
    return lower_bound(tree[d] + a, tree[d] + b, v) - tree[d] - a;
  int c = (a + b) / 2;
  if (r <= c) return cntless(v, l, r, a, c, d + 1);
  if (l >= c) return cntless(v, l, r, c, b, d + 1);
  return cntless(v, l, c, a, c, d + 1) + cntless(v, c, r, c, b, d + 1);
}
int main() {
  long long k;
  cin >> n >> k;
  for (int i = 0; i < (n); ++i) {
    int a;
    cin >> a;
    sum[i + 1] = sum[i] + a;
  }
  build(0, n, 0);
  long long a = -1000000000 * 1000000LL, b = 1000000000 * 1000000LL;
  while (b > a + 1) {
    long long v = (a + b) / 2;
    long long cnt = 0;
    for (int i = 1; i <= n; ++i) {
      cnt += cntless(sum[i] - v + 1, 0, i, 0, n, 0);
    }
    if (cnt >= k)
      a = v;
    else
      b = v;
  }
  cout << a;
  return 0;
}
