#include <bits/stdc++.h>
using namespace std;
long long n, k;
int N;
int a[100005];
long long s[100005 + 100005];
int r[100005 + 100005];
int bit[100005];
void add(int x) {
  for (; x <= n + 1; x += x & (-x)) bit[x]++;
}
int bitget(int x) {
  int res = 0;
  for (; x; x -= x & (-x)) res += bit[x];
  return res;
}
bool comp(int i, int j) {
  if (s[i] != s[j]) return s[i] < s[j];
  return i < j;
}
long long get(long long x) {
  for (int i = n + 1; i < N; i++) s[i] = s[i - n - 1] - x;
  for (int i = 0; i < N; i++) r[i] = i;
  sort(r, r + N, comp);
  long long res = 0;
  memset(bit, 0, sizeof bit);
  for (int i = 0; i < N; i++) {
    if (r[i] < n + 1)
      add(r[i] + 1);
    else
      res += bitget(r[i] - n - 1);
  }
  return res;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  s[0] = 0;
  for (int i = 0; i < n; i++) s[i + 1] = s[i] + a[i];
  N = 2 * n + 2;
  long long lo = -1e14 - 1, hi = 1e14 + 1;
  while (lo < hi) {
    long long me = lo + (hi - lo) / 2;
    if (get(me) < k)
      hi = me;
    else
      lo = me + 1;
  }
  cout << hi - 1 << endl;
}
