#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 3, inf = 1e9 + 9, mod = 1e9 + 7;
int n, k, arr[MAX];
long long fen[MAX][12];
void add(int ind, long long val, int x) {
  for (int i = ind; i <= n; i += i & -i) fen[i][x] += val;
}
long long get(int ind, int x) {
  if (!ind) return 0;
  long long res = 0;
  for (int i = ind; i > 0; i -= i & -i) res += fen[i][x];
  return res;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  k++;
  for (int i = 0; i < n; i++) cin >> arr[i + 1];
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++)
      if (j == 1)
        add(arr[i], 1, 1);
      else
        add(arr[i], get(arr[i] - 1, j - 1), j);
  }
  cout << get(n, k) << 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;
const int MAX = 1e5 + 3, inf = 1e9 + 9, mod = 1e9 + 7;
int n, k, arr[MAX];
long long fen[MAX][12];
void add(int ind, long long val, int x) {
  for (int i = ind; i <= n; i += i & -i) fen[i][x] += val;
}
long long get(int ind, int x) {
  if (!ind) return 0;
  long long res = 0;
  for (int i = ind; i > 0; i -= i & -i) res += fen[i][x];
  return res;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  k++;
  for (int i = 0; i < n; i++) cin >> arr[i + 1];
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++)
      if (j == 1)
        add(arr[i], 1, 1);
      else
        add(arr[i], get(arr[i] - 1, j - 1), j);
  }
  cout << get(n, k) << endl;
  return 0;
}

```