#include <bits/stdc++.h>
using namespace std;
long long n, K, max_k;
long long BIT[100005][12];
void update(long long val, long long idx, long long k) {
  while (idx <= n) {
    BIT[idx][k] += val;
    idx += idx & -idx;
  }
}
long long sum(long long idx, long long k) {
  if (k == 0) return 1;
  long long s = 0;
  while (idx >= 1) {
    s += BIT[idx][k];
    idx -= idx & -idx;
  }
  return s;
}
int32_t main() {
  cin >> n >> K;
  vector<long long> data(n + 1);
  max_k = (K + 1);
  for (long long i = 1; i <= n; i++) {
    cin >> data[i];
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= max_k; j++) {
      BIT[i][j] = 0;
    }
  }
  for (long long i = 1; i <= n; i++) {
    for (long long k = 1; k <= max_k; k++) {
      long long val = sum(data[i] - 1, k - 1);
      update(val, data[i], k);
    }
  }
  cout << sum(n, max_k) << endl;
  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, K, max_k;
long long BIT[100005][12];
void update(long long val, long long idx, long long k) {
  while (idx <= n) {
    BIT[idx][k] += val;
    idx += idx & -idx;
  }
}
long long sum(long long idx, long long k) {
  if (k == 0) return 1;
  long long s = 0;
  while (idx >= 1) {
    s += BIT[idx][k];
    idx -= idx & -idx;
  }
  return s;
}
int32_t main() {
  cin >> n >> K;
  vector<long long> data(n + 1);
  max_k = (K + 1);
  for (long long i = 1; i <= n; i++) {
    cin >> data[i];
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= max_k; j++) {
      BIT[i][j] = 0;
    }
  }
  for (long long i = 1; i <= n; i++) {
    for (long long k = 1; k <= max_k; k++) {
      long long val = sum(data[i] - 1, k - 1);
      update(val, data[i], k);
    }
  }
  cout << sum(n, max_k) << endl;
  return 0;
}

```