#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
long long seg[4 * N];
long long dp[15][N];
int a[N];
void update(int l, int r, int a, long long num, int now) {
  if (l > a || r < a) return;
  if (l == r) {
    seg[now] = num;
    return;
  }
  int mid = (l + r) / 2;
  update(l, mid, a, num, 2 * now);
  update(mid + 1, r, a, num, 2 * now + 1);
  seg[now] = seg[2 * now] + seg[2 * now + 1];
}
long long query(int l, int r, int a, int b, int now) {
  if (l > b || r < a) return 0;
  if (l >= a && r <= b) return seg[now];
  int mid = (l + r) / 2;
  return query(l, mid, a, b, 2 * now) + query(mid + 1, r, a, b, 2 * now + 1);
}
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) dp[1][i] = 1;
  for (int i = 2; i <= k + 1; i++) {
    memset(seg, 0, sizeof(seg));
    for (int j = 1; j <= n; j++) {
      dp[i][j] = query(1, n, 1, a[j] - 1, 1);
      update(1, n, a[j], dp[i - 1][j], 1);
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) ans += dp[k + 1][i];
  printf("%lld\n", ans);
  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;
const int N = 1e5 + 10;
long long seg[4 * N];
long long dp[15][N];
int a[N];
void update(int l, int r, int a, long long num, int now) {
  if (l > a || r < a) return;
  if (l == r) {
    seg[now] = num;
    return;
  }
  int mid = (l + r) / 2;
  update(l, mid, a, num, 2 * now);
  update(mid + 1, r, a, num, 2 * now + 1);
  seg[now] = seg[2 * now] + seg[2 * now + 1];
}
long long query(int l, int r, int a, int b, int now) {
  if (l > b || r < a) return 0;
  if (l >= a && r <= b) return seg[now];
  int mid = (l + r) / 2;
  return query(l, mid, a, b, 2 * now) + query(mid + 1, r, a, b, 2 * now + 1);
}
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) dp[1][i] = 1;
  for (int i = 2; i <= k + 1; i++) {
    memset(seg, 0, sizeof(seg));
    for (int j = 1; j <= n; j++) {
      dp[i][j] = query(1, n, 1, a[j] - 1, 1);
      update(1, n, a[j], dp[i - 1][j], 1);
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) ans += dp[k + 1][i];
  printf("%lld\n", ans);
  return 0;
}

```