#include <bits/stdc++.h>
const int nmax = 1e5 + 5;
long long aint[4 * nmax][12];
void update(int nod, int st, int dr, int x, long long val, int k) {
  if (x < st or x > dr) return;
  if (st == x and dr == x) {
    aint[nod][k] += val;
    return;
  }
  int mij = (st + dr) >> 1;
  update(nod << 1, st, mij, x, val, k);
  update(nod << 1 | 1, mij + 1, dr, x, val, k);
  aint[nod][k] = aint[nod << 1][k] + aint[nod << 1 | 1][k];
}
long long query(int nod, int st, int dr, int x, int y, int k) {
  if (y < st or x > dr) return 0;
  if (x <= st and dr <= y) return aint[nod][k];
  int mij = (st + dr) >> 1;
  return query(nod << 1, st, mij, x, y, k) +
         query(nod << 1 | 1, mij + 1, dr, x, y, k);
}
int main() {
  int n, k, c;
  std::cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    std::cin >> c;
    update(1, 1, n, c, 1, 1);
    for (int j = 2; j <= k + 1; j++) {
      long long nw = query(1, 1, n, 1, c - 1, j - 1);
      update(1, 1, n, c, nw, j);
    }
  }
  std::cout << query(1, 1, n, 1, n, k + 1);
}

### 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>
const int nmax = 1e5 + 5;
long long aint[4 * nmax][12];
void update(int nod, int st, int dr, int x, long long val, int k) {
  if (x < st or x > dr) return;
  if (st == x and dr == x) {
    aint[nod][k] += val;
    return;
  }
  int mij = (st + dr) >> 1;
  update(nod << 1, st, mij, x, val, k);
  update(nod << 1 | 1, mij + 1, dr, x, val, k);
  aint[nod][k] = aint[nod << 1][k] + aint[nod << 1 | 1][k];
}
long long query(int nod, int st, int dr, int x, int y, int k) {
  if (y < st or x > dr) return 0;
  if (x <= st and dr <= y) return aint[nod][k];
  int mij = (st + dr) >> 1;
  return query(nod << 1, st, mij, x, y, k) +
         query(nod << 1 | 1, mij + 1, dr, x, y, k);
}
int main() {
  int n, k, c;
  std::cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    std::cin >> c;
    update(1, 1, n, c, 1, 1);
    for (int j = 2; j <= k + 1; j++) {
      long long nw = query(1, 1, n, 1, c - 1, j - 1);
      update(1, 1, n, c, nw, j);
    }
  }
  std::cout << query(1, 1, n, 1, n, k + 1);
}

```