#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 10;
const int MAXK = 11;
long long arr[MAX];
map<long long, int> memo;
long long bit[MAX][MAXK];
void update(int ind, int k, long long val) {
  while (ind < MAX) {
    bit[ind][k] += val;
    ind += ind & -ind;
  }
}
long long read(int ind, int k) {
  long long s = 0;
  while (ind > 0) {
    s += bit[ind][k];
    ind -= ind & -ind;
  }
  return s;
}
vector<long long> nums;
long long ans;
int main() {
  int n;
  scanf("%d", &(n));
  ;
  int k;
  scanf("%d", &(k));
  ;
  if (k == 0) {
    cout << (n) << "\n";
    ;
    return 0;
  }
  for (int(i) = (1); (i) < (n + 1); (i)++) {
    scanf("%lld", &(arr[i]));
    memo[arr[i]] = i;
    nums.push_back(arr[i]);
  }
  sort((nums).begin(), (nums).end());
  for (auto& num : (nums)) {
    int ind = memo[num];
    update(ind, 1, 1LL);
    for (int cur_k = 2; cur_k <= k; cur_k++) {
      update(ind, cur_k, read(ind - 1, cur_k - 1));
    }
    ans += read(ind - 1, k);
  }
  cout << (ans) << "\n";
  ;
}

### Prompt

Please formulate a Cpp solution to the following problem:

For the given sequence with n different elements find the number of increasing subsequences with k + 1 elements. It is guaranteed that the answer is not greater than 8·1018.

Input

First line contain two integer values n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 10) — the length of sequence and the number of elements in increasing subsequences.

Next n lines contains one integer ai (1 ≤ ai ≤ n) each — elements of sequence. All values ai are different.

Output

Print one integer — the answer to the problem.

Examples

Input

5 2
1
2
3
5
4


Output

7

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 10;
const int MAXK = 11;
long long arr[MAX];
map<long long, int> memo;
long long bit[MAX][MAXK];
void update(int ind, int k, long long val) {
  while (ind < MAX) {
    bit[ind][k] += val;
    ind += ind & -ind;
  }
}
long long read(int ind, int k) {
  long long s = 0;
  while (ind > 0) {
    s += bit[ind][k];
    ind -= ind & -ind;
  }
  return s;
}
vector<long long> nums;
long long ans;
int main() {
  int n;
  scanf("%d", &(n));
  ;
  int k;
  scanf("%d", &(k));
  ;
  if (k == 0) {
    cout << (n) << "\n";
    ;
    return 0;
  }
  for (int(i) = (1); (i) < (n + 1); (i)++) {
    scanf("%lld", &(arr[i]));
    memo[arr[i]] = i;
    nums.push_back(arr[i]);
  }
  sort((nums).begin(), (nums).end());
  for (auto& num : (nums)) {
    int ind = memo[num];
    update(ind, 1, 1LL);
    for (int cur_k = 2; cur_k <= k; cur_k++) {
      update(ind, cur_k, read(ind - 1, cur_k - 1));
    }
    ans += read(ind - 1, k);
  }
  cout << (ans) << "\n";
  ;
}

```