#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
long long cc[12][N];
int n, k;
int lowbit(int x) { return x & (-x); }
void add(int id, int x, long long v) {
  while (x <= n) {
    cc[id][x] += v;
    x += lowbit(x);
  }
}
long long query(int id, int x) {
  long long ans = 0;
  while (x) {
    ans += cc[id][x];
    x -= lowbit(x);
  }
  return ans;
}
int aa[N];
int main() {
  while (scanf("%d%d", &n, &k) != EOF) {
    k++;
    for (int i = 0; i < n; i++) {
      scanf("%d", &aa[i]);
    }
    memset(cc, 0, sizeof(cc));
    for (int i = 0; i < n; i++) {
      add(1, aa[i], 1);
      for (int j = 2; j <= k; j++) {
        long long v = query(j - 1, aa[i] - 1);
        add(j, aa[i], v);
      }
    }
    printf("%I64d\n", query(k, n));
  }
  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;
const int N = 1e5 + 10;
long long cc[12][N];
int n, k;
int lowbit(int x) { return x & (-x); }
void add(int id, int x, long long v) {
  while (x <= n) {
    cc[id][x] += v;
    x += lowbit(x);
  }
}
long long query(int id, int x) {
  long long ans = 0;
  while (x) {
    ans += cc[id][x];
    x -= lowbit(x);
  }
  return ans;
}
int aa[N];
int main() {
  while (scanf("%d%d", &n, &k) != EOF) {
    k++;
    for (int i = 0; i < n; i++) {
      scanf("%d", &aa[i]);
    }
    memset(cc, 0, sizeof(cc));
    for (int i = 0; i < n; i++) {
      add(1, aa[i], 1);
      for (int j = 2; j <= k; j++) {
        long long v = query(j - 1, aa[i] - 1);
        add(j, aa[i], v);
      }
    }
    printf("%I64d\n", query(k, n));
  }
  return 0;
}

```