#include <bits/stdc++.h>
using namespace std;
long long n;
long long fen[12][(123456)];
long long dp[(123456)][12];
long long get(long long idx, long long* fen) {
  long long ans = 0;
  for (; idx; idx -= idx & -idx) ans += fen[idx];
  return ans;
}
void upd(long long idx, long long val, long long* fen) {
  for (; idx <= n; idx += idx & -idx) fen[idx] += val;
}
int32_t main() {
  long long k;
  cin >> n >> k;
  ++k;
  long long ans = 0;
  for (long long i = 0; i < n; ++i) {
    long long a;
    cin >> a;
    dp[i][1] = 1;
    for (long long j = 2; j <= k; ++j) dp[i][j] = get(a, fen[j - 1]);
    for (long long j = 1; j <= k; ++j) upd(a, dp[i][j], fen[j]);
    ans += dp[i][k];
  }
  cout << ans << '\n';
  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;
long long n;
long long fen[12][(123456)];
long long dp[(123456)][12];
long long get(long long idx, long long* fen) {
  long long ans = 0;
  for (; idx; idx -= idx & -idx) ans += fen[idx];
  return ans;
}
void upd(long long idx, long long val, long long* fen) {
  for (; idx <= n; idx += idx & -idx) fen[idx] += val;
}
int32_t main() {
  long long k;
  cin >> n >> k;
  ++k;
  long long ans = 0;
  for (long long i = 0; i < n; ++i) {
    long long a;
    cin >> a;
    dp[i][1] = 1;
    for (long long j = 2; j <= k; ++j) dp[i][j] = get(a, fen[j - 1]);
    for (long long j = 1; j <= k; ++j) upd(a, dp[i][j], fen[j]);
    ans += dp[i][k];
  }
  cout << ans << '\n';
  return 0;
}

```