The Little Elephant has array a, consisting of n positive integers, indexed from 1 to n. Let's denote the number with index i as ai.

The Little Elephant wants to count, how many pairs of integers l and r are there, such that 1 ≤ l < r ≤ n and sequence b = a1a2... alarar + 1... an has no more than k inversions. 

An inversion in sequence b is a pair of elements of the sequence b, that change their relative order after a stable sorting of the sequence. In other words, an inversion is a pair of integers i and j, such that 1 ≤ i < j ≤ |b| and bi > bj, where |b| is the length of sequence b, and bj is its j-th element.

Help the Little Elephant and count the number of the described pairs.

Input

The first line contains two integers n and k (2 ≤ n ≤ 105, 0 ≤ k ≤ 1018) — the size of array a and the maximum allowed number of inversions respectively. The next line contains n positive integers, separated by single spaces, a1, a2, ..., an (1 ≤ ai ≤ 109) — elements of array a.

Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier.

Output

In a single line print a single number — the answer to the problem.

Examples

Input

3 1
1 3 2


Output

3


Input

5 2
1 3 2 1 7


Output

6
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
vector<int> seg[MAXN << 2];
int a[MAXN];
long long k, inv;
int n;
void input();
void build(int, int, int);
int get(int, int, int, int, int, int);
void solve();
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  input();
  solve();
  return 0;
}
void input() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  build(1, 0, n);
}
void build(int v, int s, int e) {
  if (e - s == 1) {
    seg[v].push_back(a[s]);
    return;
  }
  int mid = (s + e) / 2;
  build(v << 1, s, mid);
  build(v << 1 | 1, mid, e);
  int pntl = 0, pntr = 0;
  for (int i = s; i < e; i++) {
    if (pntr == e - mid ||
        (pntl != mid - s && seg[v << 1][pntl] <= seg[v << 1 | 1][pntr])) {
      seg[v].push_back(seg[v << 1][pntl++]);
      inv += pntr;
    } else
      seg[v].push_back(seg[v << 1 | 1][pntr++]);
  }
}
int get(int l, int r, int c, int v, int s, int e) {
  if (l == n || r == 0) return 0;
  if (r <= s || e <= l) return 0;
  if (r >= e && l <= s) {
    int L = -1, R = seg[v].size(), mid = (L + R) / 2;
    while (R - L > 1) {
      (seg[v][mid] < c) ? L = mid : R = mid;
      mid = (L + R) / 2;
    }
    return L + 1;
  }
  int mid = (s + e) / 2;
  return get(l, r, c, v << 1, s, mid) + get(l, r, c, v << 1 | 1, mid, e);
}
void solve() {
  if (inv <= k) {
    cout << 1ll * n * (n - 1) / 2 << endl;
    return;
  }
  long long cnt = 0, ans = 0;
  get(0, 2, 10, 1, 0, n);
  for (int l = 1, r = 1; l < n - 1; l++) {
    while (r != n && inv - cnt > k) {
      cnt += get(r + 1, n, a[r], 1, 0, n);
      cnt += l - get(0, l, a[r] + 1, 1, 0, n);
      r++;
    }
    ans += n - r;
    cnt -= get(r, n, a[l], 1, 0, n);
    cnt -= l - get(0, l, a[l] + 1, 1, 0, n);
  }
  cout << ans << endl;
}
