#include <bits/stdc++.h>
using namespace std;
int n, k;
int x;
long long dp[100007][12];
inline void pisz(int v, int u, long long war) {
  for (int i = v; i <= n; i += (-i & i)) {
    dp[i][u] += war;
  }
}
inline long long czyt(int a, int b, int u) {
  long long ret = 0;
  for (int i = b; i; i -= (-i & i)) {
    ret += dp[i][u];
  }
  for (int i = a - 1; i; i -= (-i & i)) {
    ret += dp[i][u];
  }
  return ret;
}
int main() {
  scanf("%d%d", &n, &k);
  pisz(1, 0, 1);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    for (int j = k + 1; j; j--) {
      pisz(x, j, czyt(1, x, j - 1));
    }
  }
  printf("%lld\n", czyt(1, n, k + 1));
  return 0;
}

### Prompt

Generate 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;
int n, k;
int x;
long long dp[100007][12];
inline void pisz(int v, int u, long long war) {
  for (int i = v; i <= n; i += (-i & i)) {
    dp[i][u] += war;
  }
}
inline long long czyt(int a, int b, int u) {
  long long ret = 0;
  for (int i = b; i; i -= (-i & i)) {
    ret += dp[i][u];
  }
  for (int i = a - 1; i; i -= (-i & i)) {
    ret += dp[i][u];
  }
  return ret;
}
int main() {
  scanf("%d%d", &n, &k);
  pisz(1, 0, 1);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    for (int j = k + 1; j; j--) {
      pisz(x, j, czyt(1, x, j - 1));
    }
  }
  printf("%lld\n", czyt(1, n, k + 1));
  return 0;
}

```