#include <bits/stdc++.h>
using namespace std;
int n, k;
int A[100005];
unsigned long long tree[12][100005];
void update(int len, int idx, unsigned long long val) {
  while (idx <= n) {
    tree[len][idx] += val;
    idx += (idx & (-idx));
  }
  return;
}
unsigned long long query(int len, int idx) {
  unsigned long long ans = 0;
  while (idx > 0) {
    ans += tree[len][idx];
    idx -= (idx & (-idx));
  }
  return ans;
}
int main() {
  cin >> n >> k;
  k++;
  for (int i = 1; i <= n; i++) cin >> A[i];
  for (int i = 1; i <= n; i++) {
    update(1, A[i], 1LL);
    for (int j = 2; j <= min(i, k); j++)
      update(j, A[i], query(j - 1, A[i] - 1));
  }
  cout << query(k, n) << endl;
  return 0;
}

### Prompt

Create a solution in Cpp for 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, k;
int A[100005];
unsigned long long tree[12][100005];
void update(int len, int idx, unsigned long long val) {
  while (idx <= n) {
    tree[len][idx] += val;
    idx += (idx & (-idx));
  }
  return;
}
unsigned long long query(int len, int idx) {
  unsigned long long ans = 0;
  while (idx > 0) {
    ans += tree[len][idx];
    idx -= (idx & (-idx));
  }
  return ans;
}
int main() {
  cin >> n >> k;
  k++;
  for (int i = 1; i <= n; i++) cin >> A[i];
  for (int i = 1; i <= n; i++) {
    update(1, A[i], 1LL);
    for (int j = 2; j <= min(i, k); j++)
      update(j, A[i], query(j - 1, A[i] - 1));
  }
  cout << query(k, n) << endl;
  return 0;
}

```