#include <bits/stdc++.h>
using namespace std;
int n;
long long k;
long long a[200000];
struct vert {
  vert *lp, *rp;
  long long key;
  int rkey;
  int sz;
  vert(long long key) : key(key) {
    rkey = rand();
    lp = rp = 0;
    sz = 1;
  }
  vert() {}
};
void norm(vert* r) {
  if (r == 0) return;
  r->sz = 1;
  if (r->lp != 0) {
    r->sz += r->lp->sz;
  }
  if (r->rp != 0) {
    r->sz += r->rp->sz;
  }
}
vert* merge(vert* lt, vert* rt) {
  if (lt == 0) return rt;
  if (rt == 0) return lt;
  if (lt->rkey > rt->rkey) {
    lt->rp = merge(lt->rp, rt);
    norm(lt);
    return lt;
  } else {
    rt->lp = merge(lt, rt->lp);
    norm(rt);
    return rt;
  }
}
void split(vert* root, long long key, vert*& lp, vert*& rp) {
  if (root == 0) {
    lp = rp = 0;
    return;
  }
  if (root->key <= key) {
    split(root->rp, key, root->rp, rp);
    norm(root);
    lp = root;
  } else {
    split(root->lp, key, lp, root->lp);
    rp = root;
    norm(root);
  }
}
long long sum[200000];
vert pool[200000];
int fps = 0;
vert* newvert(long long key) {
  pool[fps] = vert(key);
  return pool + (fps++);
}
long long ssums[200000];
int fibs[200000];
void fibclr() { memset(fibs, 0, sizeof(int) * (n + 1)); }
void fibinc(int x) {
  while (x <= n) {
    fibs[x]++;
    x = x | (x + 1);
  }
}
int fibsum(int x) {
  if (x < 0) return 0;
  int ans = 0;
  while (x >= 0) {
    ans += fibs[x];
    x = (x & (x + 1)) - 1;
  }
  return ans;
}
int indr(long long x) {
  if (x < ssums[0]) return -1;
  return lower_bound(ssums, ssums + n + 1, x) - ssums;
}
long long over(long long v) {
  fps = 0;
  long long ans = 0;
  fibclr();
  for (int i = 0; i <= n; i++) {
    int irm = upper_bound(ssums, ssums + n + 1, sum[i] - v) - ssums,
        ir = indr(sum[i]);
    ans += fibsum(irm - 1);
    fibinc(indr(sum[i]));
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  memset(sum, 0, sizeof sum);
  for (int i = 1; i <= n; i++) sum[i] = a[i] + sum[i - 1];
  memcpy(ssums, sum, sizeof sum);
  sort(ssums, ssums + n + 1);
  long long l = -100000000000010LL, r = 100000000000010LL;
  while (l + 1 < r) {
    long long m = (l + r) / 2;
    if (over(m) < k)
      r = m;
    else
      l = m;
  }
  cout << l;
}
