#include <bits/stdc++.h>
using namespace std;
int LSONE(int x) { return x & -x; }
struct kBit {
  int N;
  vector<long long> ft[14];
  kBit(int n) {
    N = n + 10;
    for (int i = 0; i < 14; i++) {
      ft[i].assign(N, 0);
    }
  }
  void upd(int k, int x, long long val) {
    while (x < N) {
      ft[k][x] += val;
      x += LSONE(x);
    }
  }
  long long query(int k, int x) {
    long long res = 0;
    while (x > 0) {
      res += ft[k][x];
      x -= LSONE(x);
    }
    return res;
  }
};
int main() {
  for (int n, k, val; cin >> n >> k;) {
    kBit bit(n);
    long long aux;
    for (int i = 0; i < n; i++) {
      cin >> val;
      for (int j = k + 1; j > 0; j--) {
        aux = bit.query(j - 1, val);
        bit.upd(j, val, aux);
      }
      bit.upd(1, val, 1);
    }
    cout << bit.query(k + 1, n + 1) << "\n";
  }
  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;
int LSONE(int x) { return x & -x; }
struct kBit {
  int N;
  vector<long long> ft[14];
  kBit(int n) {
    N = n + 10;
    for (int i = 0; i < 14; i++) {
      ft[i].assign(N, 0);
    }
  }
  void upd(int k, int x, long long val) {
    while (x < N) {
      ft[k][x] += val;
      x += LSONE(x);
    }
  }
  long long query(int k, int x) {
    long long res = 0;
    while (x > 0) {
      res += ft[k][x];
      x -= LSONE(x);
    }
    return res;
  }
};
int main() {
  for (int n, k, val; cin >> n >> k;) {
    kBit bit(n);
    long long aux;
    for (int i = 0; i < n; i++) {
      cin >> val;
      for (int j = k + 1; j > 0; j--) {
        aux = bit.query(j - 1, val);
        bit.upd(j, val, aux);
      }
      bit.upd(1, val, 1);
    }
    cout << bit.query(k + 1, n + 1) << "\n";
  }
  return 0;
}

```