#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const int K = 12;
int n, k, a[N];
long long dp[N][K], bit[K][N], ans;
void update(int x, int y, long long v) {
  while (y <= N - 10) {
    bit[x][y] += v;
    y += (y & -y);
  }
}
long long read(int x, int y) {
  long long ret = 0;
  while (y > 0) {
    ret += bit[x][y];
    y -= (y & -y);
  }
  return ret;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    dp[i][0] = 1;
  }
  for (int i = 0; i < k + 1; i++) {
    for (int j = 0; j < n; j++) {
      dp[j][i + 1] = read(i, a[j] - 1);
      update(i, a[j], dp[j][i]);
    }
  }
  for (int i = 0; i < n; i++) ans += dp[i][k];
  printf("%lld", ans);
  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;
const int N = 1e5 + 10;
const int K = 12;
int n, k, a[N];
long long dp[N][K], bit[K][N], ans;
void update(int x, int y, long long v) {
  while (y <= N - 10) {
    bit[x][y] += v;
    y += (y & -y);
  }
}
long long read(int x, int y) {
  long long ret = 0;
  while (y > 0) {
    ret += bit[x][y];
    y -= (y & -y);
  }
  return ret;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    dp[i][0] = 1;
  }
  for (int i = 0; i < k + 1; i++) {
    for (int j = 0; j < n; j++) {
      dp[j][i + 1] = read(i, a[j] - 1);
      update(i, a[j], dp[j][i]);
    }
  }
  for (int i = 0; i < n; i++) ans += dp[i][k];
  printf("%lld", ans);
  return 0;
}

```