#include <bits/stdc++.h>
using namespace std;
const int Maxm = 524288;
const int Maxk = 12;
int n, k;
long long BIT[Maxk][Maxm];
void Insert(long long BIT[], int x, long long val) {
  while (x <= n) {
    BIT[x] += val;
    x += x & -x;
  }
}
long long Get(long long BIT[], int x) {
  long long res = 0ll;
  while (x > 0) {
    res += BIT[x];
    x -= x & -x;
  }
  return res;
}
int main() {
  scanf("%d %d", &n, &k);
  k++;
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    Insert(BIT[1], a, 1);
    for (int j = 1; j < k; j++) Insert(BIT[j + 1], a, Get(BIT[j], a - 1));
  }
  cout << Get(BIT[k], n);
  return 0;
}

### Prompt

Create a solution in CPP for 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 Maxm = 524288;
const int Maxk = 12;
int n, k;
long long BIT[Maxk][Maxm];
void Insert(long long BIT[], int x, long long val) {
  while (x <= n) {
    BIT[x] += val;
    x += x & -x;
  }
}
long long Get(long long BIT[], int x) {
  long long res = 0ll;
  while (x > 0) {
    res += BIT[x];
    x -= x & -x;
  }
  return res;
}
int main() {
  scanf("%d %d", &n, &k);
  k++;
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    Insert(BIT[1], a, 1);
    for (int j = 1; j < k; j++) Insert(BIT[j + 1], a, Get(BIT[j], a - 1));
  }
  cout << Get(BIT[k], n);
  return 0;
}

```