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>
#pragma warning(disable : 4996)
using namespace std;
struct order {
  int a, num;
  bool operator<(const order &p) const { return a < p.a; }
} ord[100010];
int n, w[100010];
int BIT[2][100010];
long long K, S;
void Ins(int pv, int a, int b) {
  while (a <= n) {
    BIT[pv][a] += b;
    a += (a & -a);
  }
}
int Sum(int pv, int a) {
  int r = 0;
  while (a) {
    r += BIT[pv][a];
    a -= (a & -a);
  }
  return r;
}
int Sum2(int pv, int a, int b) { return Sum(pv, b) - Sum(pv, a - 1); }
int main() {
  int i, cnt = 0, t, pv;
  long long Res = 0;
  scanf("%d%lld", &n, &K);
  for (i = 1; i <= n; i++) {
    scanf("%d", &ord[i].a);
    ord[i].num = i;
  }
  sort(ord + 1, ord + n + 1);
  for (i = 1; i <= n; i++) {
    if (i == 1 || ord[i].a != ord[i - 1].a) cnt++;
    w[ord[i].num] = cnt;
  }
  for (i = n; i >= 1; i--) {
    t = Sum2(1, 1, w[i] - 1);
    if (S + t > K) break;
    S += t;
    Ins(1, w[i], 1);
  }
  pv = i + 1;
  for (i = 1; i <= n; i++) {
    S += Sum2(0, w[i] + 1, n);
    S += Sum2(1, 1, w[i] - 1);
    Ins(0, w[i], 1);
    while (pv <= n && (pv == i || S > K)) {
      S -= Sum2(0, w[pv] + 1, n);
      S -= Sum2(1, 1, w[pv] - 1);
      Ins(1, w[pv], -1);
      pv++;
    }
    Res += n + 1 - pv;
  }
  printf("%lld\n", Res);
}
