#include <bits/stdc++.h>
using namespace std;
long long BIT[20][100100];
void update(long long x, long long y, long long d) {
  for (; x <= 19; x += x & (-x)) {
    int y1 = y;
    for (; y1 <= 100100; y1 += y1 & (-y1)) BIT[x][y1] += d;
  }
}
long long sum(long long x, long long y) {
  long long ret = 0;
  for (; x > 0; x -= x & (-x)) {
    int y1 = y;
    for (; y1 > 0; y1 -= y1 & (-y1)) ret += BIT[x][y1];
  }
  return ret;
}
int main() {
  int n, k;
  scanf("%d", &n);
  scanf("%d", &k);
  k++;
  for (long long i = 1; i < n + 1; i++) {
    int x;
    scanf("%d", &x);
    update(1, x, 1);
    for (long long j = 2; j < k + 1; j++) {
      long long prevCnt = sum(j - 1, x - 1) - sum(j - 2, x - 1);
      update(j, x, prevCnt);
    }
  }
  long long ans = sum(k, 100100 - 2) - sum(k - 1, 100100 - 2);
  printf("%lld\n", ans);
  return 0;
}

### Prompt

Please provide a cpp coded solution to the problem described below:

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;
long long BIT[20][100100];
void update(long long x, long long y, long long d) {
  for (; x <= 19; x += x & (-x)) {
    int y1 = y;
    for (; y1 <= 100100; y1 += y1 & (-y1)) BIT[x][y1] += d;
  }
}
long long sum(long long x, long long y) {
  long long ret = 0;
  for (; x > 0; x -= x & (-x)) {
    int y1 = y;
    for (; y1 > 0; y1 -= y1 & (-y1)) ret += BIT[x][y1];
  }
  return ret;
}
int main() {
  int n, k;
  scanf("%d", &n);
  scanf("%d", &k);
  k++;
  for (long long i = 1; i < n + 1; i++) {
    int x;
    scanf("%d", &x);
    update(1, x, 1);
    for (long long j = 2; j < k + 1; j++) {
      long long prevCnt = sum(j - 1, x - 1) - sum(j - 2, x - 1);
      update(j, x, prevCnt);
    }
  }
  long long ans = sum(k, 100100 - 2) - sum(k - 1, 100100 - 2);
  printf("%lld\n", ans);
  return 0;
}

```