#include <bits/stdc++.h>
using namespace std;
inline bool equal(double _x, double _y) {
  return _x > _y - 1e-9 && _x < _y + 1e-9;
}
int a[100000 + 5];
long long st[15][100000 * 4];
void md(int c, int id, int l, int r, int pos, long long val) {
  if (l == r) {
    st[c][id] = val;
    return;
  }
  int mid = l + r >> 1;
  if (pos <= mid)
    md(c, id * 2, l, mid, pos, val);
  else
    md(c, id * 2 + 1, mid + 1, r, pos, val);
  st[c][id] = st[c][id * 2] + st[c][id * 2 + 1];
}
long long qr(int c, int id, int l, int r, int L, int R) {
  if (L <= l && r <= R) return st[c][id];
  if (l > R || r < L) return 0;
  int mid = l + r >> 1;
  return qr(c, id * 2, l, mid, L, R) + qr(c, id * 2 + 1, mid + 1, r, L, R);
}
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = n - 1; i >= 0; i--) {
    md(1, 1, 1, n, a[i], 1);
    for (int j = 2; j <= k + 1; j++) {
      long long cnt = qr(j - 1, 1, 1, n, a[i] + 1, n);
      md(j, 1, 1, n, a[i], cnt);
    }
  }
  printf("%lld\n", qr(k + 1, 1, 1, n, 1, n));
}

### 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;
inline bool equal(double _x, double _y) {
  return _x > _y - 1e-9 && _x < _y + 1e-9;
}
int a[100000 + 5];
long long st[15][100000 * 4];
void md(int c, int id, int l, int r, int pos, long long val) {
  if (l == r) {
    st[c][id] = val;
    return;
  }
  int mid = l + r >> 1;
  if (pos <= mid)
    md(c, id * 2, l, mid, pos, val);
  else
    md(c, id * 2 + 1, mid + 1, r, pos, val);
  st[c][id] = st[c][id * 2] + st[c][id * 2 + 1];
}
long long qr(int c, int id, int l, int r, int L, int R) {
  if (L <= l && r <= R) return st[c][id];
  if (l > R || r < L) return 0;
  int mid = l + r >> 1;
  return qr(c, id * 2, l, mid, L, R) + qr(c, id * 2 + 1, mid + 1, r, L, R);
}
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = n - 1; i >= 0; i--) {
    md(1, 1, 1, n, a[i], 1);
    for (int j = 2; j <= k + 1; j++) {
      long long cnt = qr(j - 1, 1, 1, n, a[i] + 1, n);
      md(j, 1, 1, n, a[i], cnt);
    }
  }
  printf("%lld\n", qr(k + 1, 1, 1, n, 1, n));
}

```