#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
long long a[N], t[N], b[N], dp[12][N], n, k;
long long ans, ans2;
inline void add(int x, long long v) {
  for (; x <= n; x += (x & -x)) {
    t[x] += v;
  }
}
inline long long query(int x) {
  long long sum = 0;
  for (; x; x -= (x & -x)) {
    sum += t[x];
  }
  return sum;
}
int main() {
  scanf("%lld %lld", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    b[i] = a[i];
  }
  sort(b + 1, b + n + 1);
  int sz = unique(b + 1, b + n + 1) - b;
  for (int i = 1; i <= n; i++) {
    a[i] = lower_bound(b + 1, b + sz, a[i]) - b;
    dp[0][i] = 1;
  }
  for (int i = 1; i <= k; i++) {
    for (int j = 1; j <= n; j++) {
      dp[i][j] = query(a[j] - 1);
      add(a[j], dp[i - 1][j]);
    }
    for (int j = 1; j <= n; j++) {
      add(a[j], -dp[i - 1][j]);
    }
  }
  for (int i = 1; i <= n; i++) {
    ans2 += dp[k][i];
  }
  printf("%lld", ans2);
  return 0;
}

### Prompt

Please formulate a Cpp solution 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;
const int N = 1e5 + 10;
long long a[N], t[N], b[N], dp[12][N], n, k;
long long ans, ans2;
inline void add(int x, long long v) {
  for (; x <= n; x += (x & -x)) {
    t[x] += v;
  }
}
inline long long query(int x) {
  long long sum = 0;
  for (; x; x -= (x & -x)) {
    sum += t[x];
  }
  return sum;
}
int main() {
  scanf("%lld %lld", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    b[i] = a[i];
  }
  sort(b + 1, b + n + 1);
  int sz = unique(b + 1, b + n + 1) - b;
  for (int i = 1; i <= n; i++) {
    a[i] = lower_bound(b + 1, b + sz, a[i]) - b;
    dp[0][i] = 1;
  }
  for (int i = 1; i <= k; i++) {
    for (int j = 1; j <= n; j++) {
      dp[i][j] = query(a[j] - 1);
      add(a[j], dp[i - 1][j]);
    }
    for (int j = 1; j <= n; j++) {
      add(a[j], -dp[i - 1][j]);
    }
  }
  for (int i = 1; i <= n; i++) {
    ans2 += dp[k][i];
  }
  printf("%lld", ans2);
  return 0;
}

```