#include <bits/stdc++.h>
int n, k, num[100505];
long long c[100505][15];
void add(int val, long long r, int p) {
  for (; val <= n; val += (val & -val)) c[val][p] += r;
  return;
}
long long que(int val, int p) {
  long long r;
  for (r = 0ll; val; val -= (val & -val)) r += c[val][p];
  return r;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &num[i]);
  for (int j = 1; j <= n; j++) {
    add(num[j], 1, 0);
    for (int i = 1; i <= k; i++) {
      long long ls = que(num[j] - 1, i - 1);
      add(num[j], ls, i);
    }
  }
  printf("%lld\n", que(n, k));
  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>
int n, k, num[100505];
long long c[100505][15];
void add(int val, long long r, int p) {
  for (; val <= n; val += (val & -val)) c[val][p] += r;
  return;
}
long long que(int val, int p) {
  long long r;
  for (r = 0ll; val; val -= (val & -val)) r += c[val][p];
  return r;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &num[i]);
  for (int j = 1; j <= n; j++) {
    add(num[j], 1, 0);
    for (int i = 1; i <= k; i++) {
      long long ls = que(num[j] - 1, i - 1);
      add(num[j], ls, i);
    }
  }
  printf("%lld\n", que(n, k));
  return 0;
}

```