#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const int MAX = 1e5 + 10;
const int MOD = 1000000007;
long long int bit[12][524288];
int n, k;
void INSERT(long long int bit[], int idx, long long int val) {
  for (int i = idx; i <= n; i += i & -i) bit[i] += val;
}
long long int GET(long long int bit[], int idx) {
  long long int res = 0LL;
  for (int i = idx; i > 0; i -= i & -i) res += bit[i];
  return res;
}
int main() {
  cin >> n >> k;
  k++;
  for (int i = 0; i <= n - 1; i++) {
    int a;
    cin >> a;
    INSERT(bit[1], a, 1);
    for (int j = 1; j <= k - 1; j++) INSERT(bit[j + 1], a, GET(bit[j], a - 1));
  }
  cout << GET(bit[k], n) << '\n';
  return 0;
}

### Prompt

Your task is to create 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 INF = 2147483647;
const int MAX = 1e5 + 10;
const int MOD = 1000000007;
long long int bit[12][524288];
int n, k;
void INSERT(long long int bit[], int idx, long long int val) {
  for (int i = idx; i <= n; i += i & -i) bit[i] += val;
}
long long int GET(long long int bit[], int idx) {
  long long int res = 0LL;
  for (int i = idx; i > 0; i -= i & -i) res += bit[i];
  return res;
}
int main() {
  cin >> n >> k;
  k++;
  for (int i = 0; i <= n - 1; i++) {
    int a;
    cin >> a;
    INSERT(bit[1], a, 1);
    for (int j = 1; j <= k - 1; j++) INSERT(bit[j + 1], a, GET(bit[j], a - 1));
  }
  cout << GET(bit[k], n) << '\n';
  return 0;
}

```