#include <bits/stdc++.h>
using namespace std;
int n, i, j, k;
int v[100005];
long long aib[100005][12];
void add(int i, int j, long long val) {
  while (i < 100005) {
    aib[i][j] += val;
    i += ((i) & (-i));
  }
}
long long query(int i, int j) {
  long long sum = 0;
  while (i > 0) {
    sum += aib[i][j];
    i -= ((i) & (-i));
  }
  return sum;
}
int main() {
  cin >> n >> k;
  for (i = 1; i <= n; i++) {
    cin >> v[i];
    add(v[i], 0, 1);
    for (j = 1; j <= k; j++) add(v[i], j, query(v[i] - 1, j - 1));
  }
  printf("%I64d\n", query(n, k));
  return 0;
}

### Prompt

Please provide a CPP coded solution to the problem described below:

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;
int n, i, j, k;
int v[100005];
long long aib[100005][12];
void add(int i, int j, long long val) {
  while (i < 100005) {
    aib[i][j] += val;
    i += ((i) & (-i));
  }
}
long long query(int i, int j) {
  long long sum = 0;
  while (i > 0) {
    sum += aib[i][j];
    i -= ((i) & (-i));
  }
  return sum;
}
int main() {
  cin >> n >> k;
  for (i = 1; i <= n; i++) {
    cin >> v[i];
    add(v[i], 0, 1);
    for (j = 1; j <= k; j++) add(v[i], j, query(v[i] - 1, j - 1));
  }
  printf("%I64d\n", query(n, k));
  return 0;
}

```