#include <bits/stdc++.h>
using namespace std;
int n, k;
int arr[1000001];
long long int ft[1000001][15];
long long int query(int index, int lev) {
  long long int sum = 0;
  while (index) {
    sum = (sum + ft[index][lev]);
    index -= (index & -index);
  }
  return sum;
}
void update(int index, int lev, long long int sum) {
  while (index <= n) {
    ft[index][lev] = ft[index][lev] + sum;
    index += (index & -index);
  }
}
void solve() {
  cin >> n >> k;
  k++;
  for (int i = 1; i < n + 1; i++) cin >> arr[i];
  for (int i = 1; i < n + 1; i++) {
    for (int lev = 1; lev < k + 1; lev++) {
      long long int p = lev == 1 ? 1 : query(arr[i] - 1, lev - 1);
      update(arr[i], lev, p);
    }
  }
  cout << query(n, k);
}
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}

### Prompt

Your challenge is to write 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;
int n, k;
int arr[1000001];
long long int ft[1000001][15];
long long int query(int index, int lev) {
  long long int sum = 0;
  while (index) {
    sum = (sum + ft[index][lev]);
    index -= (index & -index);
  }
  return sum;
}
void update(int index, int lev, long long int sum) {
  while (index <= n) {
    ft[index][lev] = ft[index][lev] + sum;
    index += (index & -index);
  }
}
void solve() {
  cin >> n >> k;
  k++;
  for (int i = 1; i < n + 1; i++) cin >> arr[i];
  for (int i = 1; i < n + 1; i++) {
    for (int lev = 1; lev < k + 1; lev++) {
      long long int p = lev == 1 ? 1 : query(arr[i] - 1, lev - 1);
      update(arr[i], lev, p);
    }
  }
  cout << query(n, k);
}
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}

```