#include <bits/stdc++.h>
using namespace std;
long long bit[100010], arr[100010], dp[100010][12];
void update(long long val, int idx, int n) {
  for (; idx <= n; idx += idx & -idx) bit[idx] += val;
}
long long query(int idx) {
  long long sum = 0;
  for (; idx > 0; idx -= idx & -idx) sum += bit[idx];
  return sum;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    dp[i][1] = 1;
  }
  if (k == 0) return cout << n << "\n", 0;
  for (int j = 2; j <= k + 1; j++) {
    for (int i = 0; i < n; i++) bit[i + 1] = 0;
    for (int i = 1; i < n; i++) {
      update(dp[i - 1][j - 1], arr[i - 1] + 1, n);
      dp[i][j] = query(arr[i]);
    }
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) ans += dp[i][k + 1];
  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;
long long bit[100010], arr[100010], dp[100010][12];
void update(long long val, int idx, int n) {
  for (; idx <= n; idx += idx & -idx) bit[idx] += val;
}
long long query(int idx) {
  long long sum = 0;
  for (; idx > 0; idx -= idx & -idx) sum += bit[idx];
  return sum;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    dp[i][1] = 1;
  }
  if (k == 0) return cout << n << "\n", 0;
  for (int j = 2; j <= k + 1; j++) {
    for (int i = 0; i < n; i++) bit[i + 1] = 0;
    for (int i = 1; i < n; i++) {
      update(dp[i - 1][j - 1], arr[i - 1] + 1, n);
      dp[i][j] = query(arr[i]);
    }
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) ans += dp[i][k + 1];
  cout << ans << "\n";
  return 0;
}

```