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;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
const long long N = 100010;
long long n, m, a[N], lsh[N], len, l, r, cnt, flag, ans;
struct BIT {
  long long c[N];
  inline long long lowbit(long long x) { return x & -x; }
  inline void change(long long x, long long y) {
    for (; x <= n; x += lowbit(x)) c[x] += y;
  }
  inline long long query(long long x) {
    long long ans = 0;
    for (; x; x -= lowbit(x)) ans += c[x];
    return ans;
  }
  inline long long sum(long long x, long long y) {
    return query(y) - query(x - 1);
  }
} tree[2];
inline long long getid(long long x) {
  return lower_bound(lsh + 1, lsh + len + 1, x) - lsh;
}
signed main() {
  n = read();
  m = read();
  for (long long i = 1; i <= n; ++i) lsh[i] = a[i] = read();
  sort(lsh + 1, lsh + n + 1);
  len = unique(lsh + 1, lsh + n + 1) - lsh - 1;
  for (long long i = 1; i <= n; ++i) a[i] = getid(a[i]);
  l = 0, r = 1;
  for (long long i = 1; i <= n; ++i)
    cnt += tree[1].sum(a[i] + 1, n), tree[1].change(a[i], 1);
  while (l < r) {
    ++l;
    cnt += tree[0].sum(a[l] + 1, n) + tree[1].sum(1, a[l] - 1);
    tree[0].change(a[l], 1);
    while (cnt > m || l == r) {
      cnt -= tree[0].sum(a[r] + 1, n) + tree[1].sum(1, a[r] - 1);
      tree[1].change(a[r], -1);
      ++r;
      if (r > n) {
        flag = 1;
        break;
      }
    }
    if (flag) break;
    ans += n - r + 1;
  }
  printf("%lld", ans);
  return 0;
}
