#include <bits/stdc++.h>
int const N = 100100;
int const MAX = 100 + (int)1e9;
int a[N];
long long sums[N];
long long go(int l, int r, long long bound) {
  static long long temp[N];
  if (r - l == 1) {
    return 0;
  }
  int m = (l + r) / 2;
  long long ret = go(l, m, bound) + go(m, r, bound);
  for (int i = l, j = m; i < m; ++i) {
    while (j < r && sums[j] - sums[i] < bound) {
      ++j;
    }
    ret += r - j;
  }
  std::merge(sums + l, sums + m, sums + m, sums + r, temp);
  std::copy(temp, temp + r - l, sums + l);
  return ret;
}
long long getGreater(int n, long long bound) {
  ++bound;
  sums[0] = 0;
  for (int i = 0; i < n; ++i) {
    sums[i + 1] = sums[i] + a[i];
  }
  return go(0, n + 1, bound);
}
int main() {
  int n;
  long long k;
  scanf("%d%I64d", &n, &k);
  --k;
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
  }
  long long l = (long long)-N * MAX;
  long long r = -l;
  while (r - l > 1) {
    long long m = (l + r) / 2;
    if (getGreater(n, m) <= k) {
      r = m;
    } else {
      l = m;
    }
  }
  printf("%I64d\n", r);
}
