#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long int llINF = 0x3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7;
long long int v[100100];
long long int n, k;
long long int bt[20][100100];
long long int sum(long long int x, int i) {
  long long int res = 0;
  for (int j = x; j > 0; j -= (j & (-j))) {
    res += bt[i][j];
  }
  return res;
}
void upd(long long int x, int ind, int i) {
  for (int j = ind; j <= n; j += (j & (-j))) {
    bt[i][j] += x;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int i = 0; i < n; i++) {
    int s = v[i];
    for (int j = 1; j <= k; j++) {
      long long int aux = sum(s - 1, j);
      upd(aux, s, j + 1);
    }
    upd(1ll, s, 1);
  }
  long long int ans = sum(n, k + 1);
  cout << ans << endl;
}

### Prompt

In cpp, your task is to solve 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 INF = 0x3f3f3f3f;
const long long int llINF = 0x3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7;
long long int v[100100];
long long int n, k;
long long int bt[20][100100];
long long int sum(long long int x, int i) {
  long long int res = 0;
  for (int j = x; j > 0; j -= (j & (-j))) {
    res += bt[i][j];
  }
  return res;
}
void upd(long long int x, int ind, int i) {
  for (int j = ind; j <= n; j += (j & (-j))) {
    bt[i][j] += x;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int i = 0; i < n; i++) {
    int s = v[i];
    for (int j = 1; j <= k; j++) {
      long long int aux = sum(s - 1, j);
      upd(aux, s, j + 1);
    }
    upd(1ll, s, 1);
  }
  long long int ans = sum(n, k + 1);
  cout << ans << endl;
}

```