#include <bits/stdc++.h>
using namespace std;
int n;
long long int aib[15][100005];
inline void update(long long int aib[], int pos, long long int val) {
  for (; pos <= n; pos += ((pos) & (-(pos)))) aib[pos] += val;
}
inline long long int query(long long int aib[], int pos) {
  long long int ans = 0;
  for (; pos; pos -= ((pos) & (-(pos)))) ans += aib[pos];
  return ans;
}
long long int dp[15][100005];
int main() {
  ios_base ::sync_with_stdio(false);
  int k;
  cin >> n >> k;
  ++k;
  long long int ans = 0;
  int val;
  for (int i = 1; i <= n; ++i) {
    cin >> val;
    dp[1][i] = val;
    update(aib[1], val, 1);
    for (int j = 2; j <= k; ++j) {
      dp[j][i] = query(aib[j - 1], val - 1);
      update(aib[j], val, dp[j][i]);
    }
    ans += dp[k][i];
  }
  cout << ans << '\n';
  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;
long long int aib[15][100005];
inline void update(long long int aib[], int pos, long long int val) {
  for (; pos <= n; pos += ((pos) & (-(pos)))) aib[pos] += val;
}
inline long long int query(long long int aib[], int pos) {
  long long int ans = 0;
  for (; pos; pos -= ((pos) & (-(pos)))) ans += aib[pos];
  return ans;
}
long long int dp[15][100005];
int main() {
  ios_base ::sync_with_stdio(false);
  int k;
  cin >> n >> k;
  ++k;
  long long int ans = 0;
  int val;
  for (int i = 1; i <= n; ++i) {
    cin >> val;
    dp[1][i] = val;
    update(aib[1], val, 1);
    for (int j = 2; j <= k; ++j) {
      dp[j][i] = query(aib[j - 1], val - 1);
      update(aib[j], val, dp[j][i]);
    }
    ans += dp[k][i];
  }
  cout << ans << '\n';
  return 0;
}

```