#include <bits/stdc++.h>
using namespace std;
int n, m, a[100010];
long long f[100011][15], ans, c[15][100010];
void add(int r, int x, long long y) {
  for (; x <= n + 1; x += (x & (-x))) c[r][x] += y;
}
long long query(int r, int x) {
  long long sum = 0;
  for (; x; x -= (x & (-x))) sum += c[r][x];
  return sum;
}
int main() {
  scanf("%d %d", &n, &m);
  m++;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  add(0, 1, 1);
  for (int i = 1; i <= n; i++) {
    for (int k = 1; k <= m; k++) {
      f[i][k] = query(k - 1, a[i]);
      add(k, a[i] + 1, f[i][k]);
    }
    ans += f[i][m];
  }
  printf("%lld", ans);
}

### Prompt

Please create a solution in CPP 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;
int n, m, a[100010];
long long f[100011][15], ans, c[15][100010];
void add(int r, int x, long long y) {
  for (; x <= n + 1; x += (x & (-x))) c[r][x] += y;
}
long long query(int r, int x) {
  long long sum = 0;
  for (; x; x -= (x & (-x))) sum += c[r][x];
  return sum;
}
int main() {
  scanf("%d %d", &n, &m);
  m++;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  add(0, 1, 1);
  for (int i = 1; i <= n; i++) {
    for (int k = 1; k <= m; k++) {
      f[i][k] = query(k - 1, a[i]);
      add(k, a[i] + 1, f[i][k]);
    }
    ans += f[i][m];
  }
  printf("%lld", ans);
}

```