#include <bits/stdc++.h>
using namespace std;
int const N = 1e5 + 10, K = 11 + 10;
long long fen[K][N];
int n, k;
void update(int i, int p) {
  for (p++; p < N; p += p & -p) fen[i][p]++;
}
void update(long long x, int p, int i) {
  for (p++; p < N; p += p & -p) fen[i][p] += x;
}
long long get(int i, int p) {
  long long ans = 0;
  for (p++; p; p -= p & -p) ans += fen[i][p];
  return ans;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    update(1, a, 1);
    for (int j = 2; j <= k + 1; j++) update(get(j - 1, a - 1), a, j);
  }
  cout << get(k + 1, n + 10);
}

### 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;
int const N = 1e5 + 10, K = 11 + 10;
long long fen[K][N];
int n, k;
void update(int i, int p) {
  for (p++; p < N; p += p & -p) fen[i][p]++;
}
void update(long long x, int p, int i) {
  for (p++; p < N; p += p & -p) fen[i][p] += x;
}
long long get(int i, int p) {
  long long ans = 0;
  for (p++; p; p -= p & -p) ans += fen[i][p];
  return ans;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    update(1, a, 1);
    for (int j = 2; j <= k + 1; j++) update(get(j - 1, a - 1), a, j);
  }
  cout << get(k + 1, n + 10);
}

```