#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5 + 20;
long long N, K, dn[maxn][12], fw[maxn], res;
pair<long long, long long> ar[maxn];
long long find(long long a) {
  long long ret = 0;
  for (long long i = a; i > 0; i -= i & (-i)) ret += fw[i];
  return ret;
}
void upd(long long a, long long b) {
  for (long long i = a; i <= N; i += i & (-i)) fw[i] += b;
}
int main() {
  cin >> N >> K;
  K++;
  for (long long i = 1; i <= N; i++) dn[i][1] = 1;
  for (long long i = 1; i <= N; i++) {
    scanf("%lld", &ar[i].first);
    ar[i].second = i;
  }
  sort(ar + 1, ar + N + 1);
  for (long long i = 2; i <= K; i++) {
    memset(fw, 0, sizeof fw);
    for (long long j = 1; j <= N; j++) {
      dn[ar[j].second][i] = find(ar[j].second);
      upd(ar[j].second, dn[ar[j].second][i - 1]);
    }
  }
  for (long long i = 1; i <= N; i++) res += dn[i][K];
  cout << res << '\n';
  return 0;
}

### Prompt

Please formulate 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 long long maxn = 1e5 + 20;
long long N, K, dn[maxn][12], fw[maxn], res;
pair<long long, long long> ar[maxn];
long long find(long long a) {
  long long ret = 0;
  for (long long i = a; i > 0; i -= i & (-i)) ret += fw[i];
  return ret;
}
void upd(long long a, long long b) {
  for (long long i = a; i <= N; i += i & (-i)) fw[i] += b;
}
int main() {
  cin >> N >> K;
  K++;
  for (long long i = 1; i <= N; i++) dn[i][1] = 1;
  for (long long i = 1; i <= N; i++) {
    scanf("%lld", &ar[i].first);
    ar[i].second = i;
  }
  sort(ar + 1, ar + N + 1);
  for (long long i = 2; i <= K; i++) {
    memset(fw, 0, sizeof fw);
    for (long long j = 1; j <= N; j++) {
      dn[ar[j].second][i] = find(ar[j].second);
      upd(ar[j].second, dn[ar[j].second][i - 1]);
    }
  }
  for (long long i = 1; i <= N; i++) res += dn[i][K];
  cout << res << '\n';
  return 0;
}

```