#include <bits/stdc++.h>
using namespace std;
long long n, k, x[100010], bit[12][100010]{};
void upd(long long *bit, int i, long long v) {
  while (i <= n) {
    bit[i] += v;
    i += i & -i;
  }
}
long long query(long long *bit, int i) {
  long long s = 0;
  while (i > 0) {
    s += bit[i];
    i -= i & -i;
  }
  return s;
}
int main() {
  scanf("%I64d%I64d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%I64d", &x[i]);
  for (int i = 0; i < n; i++) {
    upd(bit[1], x[i], 1);
    for (int j = 1; j <= k; j++) upd(bit[j + 1], x[i], query(bit[j], x[i] - 1));
  }
  printf("%I64d\n", query(bit[k + 1], n));
  return 0;
}

### Prompt

Develop a solution in cpp 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;
long long n, k, x[100010], bit[12][100010]{};
void upd(long long *bit, int i, long long v) {
  while (i <= n) {
    bit[i] += v;
    i += i & -i;
  }
}
long long query(long long *bit, int i) {
  long long s = 0;
  while (i > 0) {
    s += bit[i];
    i -= i & -i;
  }
  return s;
}
int main() {
  scanf("%I64d%I64d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%I64d", &x[i]);
  for (int i = 0; i < n; i++) {
    upd(bit[1], x[i], 1);
    for (int j = 1; j <= k; j++) upd(bit[j + 1], x[i], query(bit[j], x[i] - 1));
  }
  printf("%I64d\n", query(bit[k + 1], n));
  return 0;
}

```