#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 1;
long long int sum[maxn + 1];
long long int a[maxn], b[maxn];
void add(int i, long long int k) {
  for (; i <= maxn; i += i & -i) {
    sum[i] += k;
  }
}
long long int get(int i) {
  long long int ret = 0;
  for (; i; i -= i & -i) {
    ret += sum[i];
  }
  return ret;
}
int main() {
  int n, k;
  cin >> n >> k;
  k = k + 1;
  for (int i = 0; i < n; i++) cin >> a[i], a[i]++, b[i] = 1;
  for (int i = 0; i < k; i++) {
    memset(sum, 0, sizeof(sum));
    for (int j = 0; j < n; j++) {
      add(a[j], b[j]);
      b[j] = get(a[j] - 1);
    }
  }
  cout << get(maxn) << "\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;
const int maxn = 1e5 + 1;
long long int sum[maxn + 1];
long long int a[maxn], b[maxn];
void add(int i, long long int k) {
  for (; i <= maxn; i += i & -i) {
    sum[i] += k;
  }
}
long long int get(int i) {
  long long int ret = 0;
  for (; i; i -= i & -i) {
    ret += sum[i];
  }
  return ret;
}
int main() {
  int n, k;
  cin >> n >> k;
  k = k + 1;
  for (int i = 0; i < n; i++) cin >> a[i], a[i]++, b[i] = 1;
  for (int i = 0; i < k; i++) {
    memset(sum, 0, sizeof(sum));
    for (int j = 0; j < n; j++) {
      add(a[j], b[j]);
      b[j] = get(a[j] - 1);
    }
  }
  cout << get(maxn) << "\n";
  return 0;
}

```