#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
long long c[20][N + 5], a[N + 5];
int n, k;
long long lowbit(long long x) { return x & (-x); }
void add(int t, long long x, long long w) {
  long long p = x;
  while (p <= n) {
    c[t][p] += w;
    p += lowbit(p);
  }
}
long long Sigma(int t, long long x) {
  long long p = x, ans = 0;
  while (p > 0) {
    ans += c[t][p];
    p -= lowbit(p);
  }
  return ans;
}
int main() {
  while (~scanf("%d %d", &n, &k)) {
    memset(c, 0, sizeof(c));
    k++;
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    for (int i = 1; i <= n; i++) {
      add(1, a[i], 1);
      for (int t = 2; t <= k; t++) {
        long long detal = Sigma(t - 1, a[i] - 1);
        add(t, a[i], detal);
      }
    }
    printf("%I64d\n", Sigma(k, n));
  }
  return 0;
}

### Prompt

Please formulate 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 = 1e6 + 10;
long long c[20][N + 5], a[N + 5];
int n, k;
long long lowbit(long long x) { return x & (-x); }
void add(int t, long long x, long long w) {
  long long p = x;
  while (p <= n) {
    c[t][p] += w;
    p += lowbit(p);
  }
}
long long Sigma(int t, long long x) {
  long long p = x, ans = 0;
  while (p > 0) {
    ans += c[t][p];
    p -= lowbit(p);
  }
  return ans;
}
int main() {
  while (~scanf("%d %d", &n, &k)) {
    memset(c, 0, sizeof(c));
    k++;
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    for (int i = 1; i <= n; i++) {
      add(1, a[i], 1);
      for (int t = 2; t <= k; t++) {
        long long detal = Sigma(t - 1, a[i] - 1);
        add(t, a[i], detal);
      }
    }
    printf("%I64d\n", Sigma(k, n));
  }
  return 0;
}

```