#include <bits/stdc++.h>
long long tree[12][200005] = {0}, arr[100005] = {0}, tmp;
int n, k, i, j;
long long fsum(int t, int idx) {
  long long ans = 0;
  while (idx > 0) {
    ans += tree[t][idx];
    idx -= (idx & -idx);
  }
  return ans;
}
void updat(int t, int idx, long long val) {
  while (idx <= n) {
    tree[t][idx] += val;
    idx += (idx & -idx);
  }
}
int main() {
  scanf("%d %d", &n, &k);
  for (i = 1; i <= n; i++) {
    scanf("%lld", &arr[i]);
    updat(1, arr[i], 1);
    for (j = 2; j <= k + 1; j++) {
      tmp = fsum(j - 1, arr[i] - 1);
      updat(j, arr[i], tmp);
    }
  }
  printf("%lld", fsum(k + 1, n));
  return 0;
}

### Prompt

Generate 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>
long long tree[12][200005] = {0}, arr[100005] = {0}, tmp;
int n, k, i, j;
long long fsum(int t, int idx) {
  long long ans = 0;
  while (idx > 0) {
    ans += tree[t][idx];
    idx -= (idx & -idx);
  }
  return ans;
}
void updat(int t, int idx, long long val) {
  while (idx <= n) {
    tree[t][idx] += val;
    idx += (idx & -idx);
  }
}
int main() {
  scanf("%d %d", &n, &k);
  for (i = 1; i <= n; i++) {
    scanf("%lld", &arr[i]);
    updat(1, arr[i], 1);
    for (j = 2; j <= k + 1; j++) {
      tmp = fsum(j - 1, arr[i] - 1);
      updat(j, arr[i], tmp);
    }
  }
  printf("%lld", fsum(k + 1, n));
  return 0;
}

```