#include <bits/stdc++.h>
using namespace std;
int a[100005], n, k;
long long res, tree[15][100005];
int max_ele;
void update(int i, int k, long long val) {
  for (; i <= n; i += i & -i) tree[k][i] += val;
}
long long get(int i, int k) {
  long long t = 0;
  for (; i; i -= i & -i) t += tree[k][i];
  return t;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  k++;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    max_ele = max(max_ele, a[i]);
    update(a[i], 1, 1);
    for (int j = 2; j <= k; ++j) update(a[i], j, get(a[i] - 1, j - 1));
  }
  res += get(max_ele, k);
  cout << res;
  return 0;
}

### Prompt

Your task is to create 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 a[100005], n, k;
long long res, tree[15][100005];
int max_ele;
void update(int i, int k, long long val) {
  for (; i <= n; i += i & -i) tree[k][i] += val;
}
long long get(int i, int k) {
  long long t = 0;
  for (; i; i -= i & -i) t += tree[k][i];
  return t;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  k++;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    max_ele = max(max_ele, a[i]);
    update(a[i], 1, 1);
    for (int j = 2; j <= k; ++j) update(a[i], j, get(a[i] - 1, j - 1));
  }
  res += get(max_ele, k);
  cout << res;
  return 0;
}

```