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;
const int N = 100 * 1000 + 10;
int a[N];
vector<int> seg[N * 4];
void build(int v, int s, int e) {
  if (e - s < 2) {
    seg[v].push_back(a[s]);
    return;
  }
  int mid = (s + e) / 2;
  build(2 * v, s, mid);
  build(2 * v + 1, mid, e);
  int i = 0, j = 0;
  while (i < ((int)(seg[2 * v]).size()) && j < ((int)(seg[2 * v + 1]).size()))
    if (seg[2 * v][i] < seg[2 * v + 1][j])
      seg[v].push_back(seg[2 * v][i]), i++;
    else
      seg[v].push_back(seg[2 * v + 1][j]), j++;
  while (i < ((int)(seg[2 * v]).size())) seg[v].push_back(seg[2 * v][i]), i++;
  while (j < ((int)(seg[2 * v + 1]).size()))
    seg[v].push_back(seg[2 * v + 1][j]), j++;
}
int get(int l, int r, int k, int t, int v, int s, int e) {
  if (r <= s || l >= e) return 0;
  if (l <= s && e <= r) {
    if (t == 0)
      return lower_bound((seg[v]).begin(), (seg[v]).end(), k) - seg[v].begin();
    else
      return ((int)(seg[v]).size()) -
             (upper_bound((seg[v]).begin(), (seg[v]).end(), k) -
              seg[v].begin());
  }
  int mid = (s + e) / 2;
  return get(l, r, k, t, 2 * v, s, mid) + get(l, r, k, t, 2 * v + 1, mid, e);
}
int i, j, n;
long long k, val;
void move_j() {
  while (j < n && val < k) {
    val += get(0, i, a[j], 1, 1, 0, n);
    val += get(j, n, a[j], 0, 1, 0, n);
    j++;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  ;
  cin >> n >> k;
  for (auto i = (0); i <= (n - 1); i++) cin >> a[i];
  build(1, 0, n);
  long long X = 0;
  for (auto i = (0); i <= (n - 1); i++) X += get(0, i, a[i], 1, 1, 0, n);
  if (X <= k) {
    cout << 1LL * n * (n - 1) / 2 << '\n';
    return 0;
  }
  k = X - k;
  move_j();
  long long ans = 0;
  while (i < n - 1) {
    val -= get(0, i, a[i], 1, 1, 0, n);
    val -= get(j, n, a[i], 0, 1, 0, n);
    i++;
    move_j();
    if (val >= k) ans += n - j;
  }
  cout << ans << '\n';
  return 0;
}
