#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d, e, fen[100009][12], f[100009], dp[100009][12];
long long read(long long q, long long w) {
  long long jm = 0;
  while (q >= 1) {
    jm += fen[q][w];
    q = q - (q & (-q));
  }
  return jm;
}
void upd(long long q, long long w, long long r) {
  while (q <= a) {
    fen[q][r] += w;
    q = q + (q & (-q));
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> a >> b;
  b++;
  for (c = 1; c <= a; c++) cin >> f[c];
  for (c = 1; c <= a; c++) {
    dp[c][1] = 1;
    for (d = 2; d <= b; d++) {
      dp[c][d] = read(f[c], d - 1);
    }
    for (d = 1; d <= b; d++) {
      upd(f[c], dp[c][d], d);
    }
  }
  e = 0;
  for (c = 1; c <= a; c++) {
    e += dp[c][b];
  }
  cout << e;
  return 0;
}

### Prompt

Please create a solution in CPP 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;
long long a, b, c, d, e, fen[100009][12], f[100009], dp[100009][12];
long long read(long long q, long long w) {
  long long jm = 0;
  while (q >= 1) {
    jm += fen[q][w];
    q = q - (q & (-q));
  }
  return jm;
}
void upd(long long q, long long w, long long r) {
  while (q <= a) {
    fen[q][r] += w;
    q = q + (q & (-q));
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> a >> b;
  b++;
  for (c = 1; c <= a; c++) cin >> f[c];
  for (c = 1; c <= a; c++) {
    dp[c][1] = 1;
    for (d = 2; d <= b; d++) {
      dp[c][d] = read(f[c], d - 1);
    }
    for (d = 1; d <= b; d++) {
      upd(f[c], dp[c][d], d);
    }
  }
  e = 0;
  for (c = 1; c <= a; c++) {
    e += dp[c][b];
  }
  cout << e;
  return 0;
}

```