#include <bits/stdc++.h>
using namespace std;
const long long int inf = 1e9 + 7;
const long long int mod = 1e9 + 7;
long long int mini(long long int a, long long int b) {
  if (a >= b) return b;
  return a;
}
long long int maxi(long long int a, long long int b) {
  if (a >= b) return a;
  return b;
}
long long int fen[100005][13];
void update(long long int i, long long int val, long long int bit) {
  while (i < 100005) {
    fen[i][bit] += val;
    i = i + (i & (-i));
  }
}
long long int sum(long long int idx, long long int bit) {
  long long int s = 0;
  while (idx > 0) {
    s += fen[idx][bit];
    idx = idx - (idx & (-idx));
  }
  return s;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long int n, k;
  cin >> n >> k;
  long long int fans = 0;
  for (long long int i = 1; i <= n; i++) {
    long long int a;
    cin >> a;
    update(a, 1, 1);
    for (long long int j = 2; j <= k + 1; j++) {
      long long int s = sum(a - 1, j - 1);
      update(a, s, j);
    }
  }
  fans = sum(n, k + 1);
  cout << fans;
  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;
const long long int inf = 1e9 + 7;
const long long int mod = 1e9 + 7;
long long int mini(long long int a, long long int b) {
  if (a >= b) return b;
  return a;
}
long long int maxi(long long int a, long long int b) {
  if (a >= b) return a;
  return b;
}
long long int fen[100005][13];
void update(long long int i, long long int val, long long int bit) {
  while (i < 100005) {
    fen[i][bit] += val;
    i = i + (i & (-i));
  }
}
long long int sum(long long int idx, long long int bit) {
  long long int s = 0;
  while (idx > 0) {
    s += fen[idx][bit];
    idx = idx - (idx & (-idx));
  }
  return s;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long int n, k;
  cin >> n >> k;
  long long int fans = 0;
  for (long long int i = 1; i <= n; i++) {
    long long int a;
    cin >> a;
    update(a, 1, 1);
    for (long long int j = 2; j <= k + 1; j++) {
      long long int s = sum(a - 1, j - 1);
      update(a, s, j);
    }
  }
  fans = sum(n, k + 1);
  cout << fans;
  return 0;
}

```