#include <bits/stdc++.h>
using namespace std;
const int maxn = 100002;
const int maxfen = maxn * 10;
long long vals[20][maxn];
long long fen[maxfen];
int arr[maxn];
long long get(int ind) {
  long long ret = 0;
  while (ind > 0) {
    ret += fen[ind];
    ind -= ind & (-ind);
  }
  return ret;
}
void upd(int ind, long long val) {
  while (ind < maxfen) {
    fen[ind] += val;
    ind += ind & (-ind);
  }
}
int main() {
  int n, k;
  cin >> n >> k;
  k++;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int i = 0; i < n; i++) {
    vals[1][i] = 1;
  }
  for (int i = 2; i <= k; i++) {
    memset(fen, 0, sizeof fen);
    for (int j = 0; j < n; j++) {
      vals[i][j] = get(arr[j] - 1);
      upd(arr[j], vals[i - 1][j]);
    }
  }
  long long out = 0;
  for (int i = 0; i < n; i++) {
    out += vals[k][i];
  }
  cout << out << endl;
  return 0;
}

### Prompt

Your task is to create 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;
const int maxn = 100002;
const int maxfen = maxn * 10;
long long vals[20][maxn];
long long fen[maxfen];
int arr[maxn];
long long get(int ind) {
  long long ret = 0;
  while (ind > 0) {
    ret += fen[ind];
    ind -= ind & (-ind);
  }
  return ret;
}
void upd(int ind, long long val) {
  while (ind < maxfen) {
    fen[ind] += val;
    ind += ind & (-ind);
  }
}
int main() {
  int n, k;
  cin >> n >> k;
  k++;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int i = 0; i < n; i++) {
    vals[1][i] = 1;
  }
  for (int i = 2; i <= k; i++) {
    memset(fen, 0, sizeof fen);
    for (int j = 0; j < n; j++) {
      vals[i][j] = get(arr[j] - 1);
      upd(arr[j], vals[i - 1][j]);
    }
  }
  long long out = 0;
  for (int i = 0; i < n; i++) {
    out += vals[k][i];
  }
  cout << out << endl;
  return 0;
}

```