#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
long long a[maxn], dp[maxn], re, n, fen[maxn], k;
void up(int u, long long v) {
  for (int i = u; i <= n; i += i & (-i)) {
    fen[i] += v;
  }
}
long long gt(int u) {
  long long o = 0;
  for (int i = u; i > 0; i -= i & (-i)) {
    o += fen[i];
  }
  return o;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    dp[i] = 1;
    cin >> a[i];
  }
  for (int i = 0; i < k; ++i) {
    memset(fen, 0, sizeof fen);
    for (int j = 0; j < n; ++j) {
      long long h = gt(a[j]);
      up(a[j], dp[j]);
      dp[j] = h;
    }
  }
  long long re = 0;
  for (int i = 0; i < n; ++i) {
    re += dp[i];
  }
  cout << re;
  return 0;
}

### Prompt

Develop a solution in cpp to the problem described below:

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 = 1e5 + 5;
long long a[maxn], dp[maxn], re, n, fen[maxn], k;
void up(int u, long long v) {
  for (int i = u; i <= n; i += i & (-i)) {
    fen[i] += v;
  }
}
long long gt(int u) {
  long long o = 0;
  for (int i = u; i > 0; i -= i & (-i)) {
    o += fen[i];
  }
  return o;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    dp[i] = 1;
    cin >> a[i];
  }
  for (int i = 0; i < k; ++i) {
    memset(fen, 0, sizeof fen);
    for (int j = 0; j < n; ++j) {
      long long h = gt(a[j]);
      up(a[j], dp[j]);
      dp[j] = h;
    }
  }
  long long re = 0;
  for (int i = 0; i < n; ++i) {
    re += dp[i];
  }
  cout << re;
  return 0;
}

```