#include <bits/stdc++.h>
using namespace std;
long long fe[12][100005], n, k;
void add(long long i, long long val, long long sz) {
  for (i; i <= n; i += i & -i) {
    fe[sz][i] += val;
  }
}
long long sum(long long i, long long sz) {
  long long ans = 0;
  for (i; i > 0; i -= i & -i) ans += fe[sz][i];
  return ans;
}
int main() {
  cin >> n >> k;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    add(a[i], 1, 1);
    for (long long j = k + 1; j > 1; j--) {
      add(a[i], sum(a[i] - 1, j - 1), j);
    }
  }
  cout << sum(n, k + 1);
  return 0;
}

### Prompt

Please formulate 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 fe[12][100005], n, k;
void add(long long i, long long val, long long sz) {
  for (i; i <= n; i += i & -i) {
    fe[sz][i] += val;
  }
}
long long sum(long long i, long long sz) {
  long long ans = 0;
  for (i; i > 0; i -= i & -i) ans += fe[sz][i];
  return ans;
}
int main() {
  cin >> n >> k;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    add(a[i], 1, 1);
    for (long long j = k + 1; j > 1; j--) {
      add(a[i], sum(a[i] - 1, j - 1), j);
    }
  }
  cout << sum(n, k + 1);
  return 0;
}

```