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;
template <class T>
inline void read(T& x) {
  bool fu = 0;
  char c;
  for (c = getchar(); c <= 32; c = getchar())
    ;
  if (c == '-') fu = 1, c = getchar();
  for (x = 0; c > 32; c = getchar()) x = x * 10 + c - '0';
  if (fu) x = -x;
};
template <class T>
inline void read(T& x, T& y) {
  read(x);
  read(y);
}
template <class T>
inline void read(T& x, T& y, T& z) {
  read(x);
  read(y);
  read(z);
}
inline char getc() {
  char c;
  for (c = getchar(); c <= 32; c = getchar())
    ;
  return c;
}
const int N = 100010;
int n, i, j, k, l, p;
long long K, now, tt;
int a[N], o[N];
struct bit {
  int s[N];
  void A(int i, int t) {
    for (; i <= o[0]; i += i & -i) s[i] += t;
  }
  int S(int i) {
    int ans = 0;
    for (; i; i -= i & -i) ans += s[i];
    return ans;
  }
  int get0(int x) { return S(x - 1); }
  int get1(int x) { return S(o[0]) - S(x); }
} T1, T2;
int main() {
  read(n);
  read(K);
  for (i = 1; i <= n; i++) read(a[i]);
  memcpy(o, a, sizeof(a));
  sort(o + 1, o + 1 + n);
  j = 1;
  for (i = 2; i <= n; i++)
    if (o[i] != o[i - 1]) o[++j] = o[i];
  o[0] = j;
  for (i = 1; i <= n; i++) a[i] = lower_bound(o + 1, o + 1 + o[0], a[i]) - o;
  for (i = 1; i <= n - 1; i++) {
    tt = T1.get1(a[i]);
    if (now + tt <= K)
      now += tt, T1.A(a[i], 1);
    else
      break;
  }
  l = i - 1;
  long long ans = 0;
  for (i = n; i >= 1; i--) {
    while (l >= i) {
      now -= T1.get1(a[l]) + T2.get0(a[l]);
      T1.A(a[l], -1);
      l--;
    }
    now += T1.get1(a[i]) + T2.get0(a[i]);
    T2.A(a[i], 1);
    while (l > 0 && now > K) {
      now -= T1.get1(a[l]) + T2.get0(a[l]);
      T1.A(a[l], -1);
      l--;
    }
    ans += l;
  }
  cout << ans << endl;
  scanf("\n");
  return 0;
}
