#include <bits/stdc++.h>
using namespace std;
vector<long long int> ma;
long long int pre[100009], k;
int tree[100009], n;
void update(int idx, int val) {
  while (idx <= n) {
    tree[idx] += val;
    idx += (idx & -idx);
  }
}
int sum(int idx) {
  int val = 0;
  while (idx > 0) {
    val += tree[idx];
    idx -= (idx & -idx);
  }
  return val;
}
int calidx(long long int val) {
  int idx = lower_bound(ma.begin(), ma.end(), val) - ma.begin();
  return idx + 1;
}
bool check(long long int val) {
  long long int ans = 0, tmp = val;
  for (int i = int(0); i <= int(n - 1); i++) update(calidx(pre[i]), 1);
  for (int i = int(0); i <= int(n - 1); i++) {
    ans += sum(n) - sum(calidx(tmp) - 1);
    update(calidx(pre[i]), -1);
    tmp = val + pre[i];
  }
  if (ans >= k) return true;
  return false;
}
int main() {
  scanf("%d", &n);
  scanf("%lld", &k);
  for (int i = int(0); i <= int(n - 1); i++) scanf("%lld", &pre[i]);
  for (int i = int(1); i <= int(n - 1); i++) pre[i] += pre[i - 1];
  for (int i = int(0); i <= int(n - 1); i++) ma.push_back(pre[i]);
  sort(ma.begin(), ma.end());
  long long int low = -1 * 2000000000 * 1ll * 100000,
                high = 2000000000 * 1ll * 100000;
  while (low < high) {
    long long int mid = (low + high + 1) / 2;
    if (check(mid))
      low = mid;
    else
      high = mid - 1;
  }
  printf("%lld\n", low);
  return 0;
}
