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;
long long SZ;
const long long nil = 0;
struct SegmentTree {
  vector<long long> seg;
  SegmentTree(long long n) {
    SZ = 1;
    while (SZ < n) SZ *= 2;
    seg.resize(SZ * 2 - 1, 0);
  }
  void add(long long i, long long x) {
    i += SZ - 1;
    seg[i] += x;
    while (i) {
      i = (i - 1) / 2;
      seg[i] = seg[2 * i + 1] + seg[2 * i + 2];
    }
  }
  long long getsum(long long a, long long b, long long i = 0, long long l = 0,
                   long long r = SZ) {
    if (b <= l or r <= a) {
      return nil;
    } else if (a <= l and r <= b) {
      return seg[i];
    } else {
      long long m = (r + l) / 2;
      long long vl = getsum(a, b, 2 * i + 1, l, m);
      long long vr = getsum(a, b, 2 * i + 2, m, r);
      return vl + vr;
    }
  }
};
signed main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  long long N, K;
  cin >> N >> K;
  vector<long long> a(N);
  for (long long i = 0; i < (N); i++) cin >> a[i];
  vector<pair<long long, long long> > v;
  for (long long i = 0; i < (N); i++)
    v.push_back(pair<long long, long long>(a[i], i));
  sort(v.begin(), v.end());
  long long foo = 0, bar = v[0].first;
  for (long long i = 0; i < (N); i++) {
    if (v[i].first == bar) {
      a[v[i].second] = foo;
    } else {
      a[v[i].second] = ++foo;
    }
    bar = v[i].first;
  }
  SegmentTree lt(N), rt(N);
  long long inv = 0;
  for (long long i = N - 1; i > 0; i--) {
    inv += rt.getsum(0, a[i]);
    rt.add(a[i], 1);
  }
  long long j = 1;
  long long cnt = 0;
  for (long long i = 0; i < (N); i++) {
    inv += lt.getsum(a[i] + 1, N);
    inv += rt.getsum(0, a[i]);
    lt.add(a[i], 1);
    while (i == j) {
      inv -= rt.getsum(0, a[j]);
      inv -= lt.getsum(a[j] + 1, N);
      rt.add(a[j], -1);
      j++;
    }
    while (j < N and inv > K) {
      inv -= rt.getsum(0, a[j]);
      inv -= lt.getsum(a[j] + 1, N);
      rt.add(a[j], -1);
      j++;
    }
    cnt += (N - j);
  }
  cout << cnt << endl;
  return 0;
}
