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;
struct Node {
  vector<int> v;
  Node *pl, *pr;
  Node(int n, const int a[]) : v(n), pl(NULL), pr(NULL) {
    if (n == 1) {
      v[0] = a[0];
    } else {
      int m = n / 2;
      pl = new Node(m, a);
      pr = new Node(n - m, a + m);
      merge(pl->v.begin(), pl->v.end(), pr->v.begin(), pr->v.end(), v.begin());
    }
  }
  ~Node() {
    delete pl;
    delete pr;
  }
  int size() const { return v.size(); }
  int clt(int x) const {
    return lower_bound(v.begin(), v.end(), x) - v.begin();
  }
  int ceq(int x) const {
    auto r = equal_range(v.begin(), v.end(), x);
    return r.second - r.first;
  }
  int cgt(int x) const { return v.end() - upper_bound(v.begin(), v.end(), x); }
  template <typename T>
  int cf(int l, int r, int x, T f) const {
    l = max(0, l);
    r = min(r, size());
    if (l >= r) {
      return 0;
    } else if (l == 0 && r == size()) {
      return f(this, x);
    } else {
      return pl->cf(l, r, x, f) + pr->cf(l - pl->size(), r - pl->size(), x, f);
    }
  }
  int clt(int l, int r, int x) const {
    return cf(l, r, x, [](const Node* self, int x) { return self->clt(x); });
  }
  int ceq(int l, int r, int x) const {
    return cf(l, r, x, [](const Node* self, int x) { return self->ceq(x); });
  }
  int cgt(int l, int r, int x) const {
    return cf(l, r, x, [](const Node* self, int x) { return self->cgt(x); });
  }
};
const int MAXN = 100100;
int a[MAXN];
int main() {
  int n;
  Node* p;
  long long m, s;
  scanf("%d", &n);
  scanf("%I64d", &m);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  p = new Node(n, a);
  for (int i = 1; i < n; ++i) {
    m -= p->clt(i + 1, n, a[i]);
  }
  s = 0;
  for (int i = 0, j = 1; i < n && j < n; ++i) {
    m -= p->cgt(0, i, a[i]);
    m -= p->clt(j, n, a[i]);
    while (j < n && (j <= i || m < 0)) {
      m += p->cgt(0, i + 1, a[j]);
      m += p->clt(j, n, a[j]);
      ++j;
    }
    s += n - j;
  }
  printf("%I64d\n", s);
  delete p;
  return 0;
}
