#include <bits/stdc++.h>
using namespace std;
struct BIT {
  std::vector<long long> v;
  void init(long long n) {
    long long i;
    for (i = 0; i < n; i++) {
      v.push_back(0);
    }
  }
  void upd(long long i, long long x) {
    for (; i < v.size(); i = (i | (i + 1))) {
      v[i] += x;
    }
  }
  long long sum(long long r) {
    long long res = 0;
    for (; r >= 0; r = (r & (r + 1)) - 1) {
      res += v[r];
    }
    return res;
  }
};
int main() {
  long long n, l, i, x, k;
  cin >> n >> k;
  BIT btree[20];
  for (i = 0; i < 20; i++) {
    btree[i].init(n + 70);
  }
  long long a[70] = {0};
  for (i = 0; i < n; i++) {
    cin >> x;
    for (l = k + 1; l >= 2; l--) {
      btree[l].upd(x, btree[l - 1].sum(x - 1));
    }
    btree[1].upd(x, 1);
  }
  cout << btree[k + 1].sum(n);
  return 0;
}

### Prompt

Generate 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;
struct BIT {
  std::vector<long long> v;
  void init(long long n) {
    long long i;
    for (i = 0; i < n; i++) {
      v.push_back(0);
    }
  }
  void upd(long long i, long long x) {
    for (; i < v.size(); i = (i | (i + 1))) {
      v[i] += x;
    }
  }
  long long sum(long long r) {
    long long res = 0;
    for (; r >= 0; r = (r & (r + 1)) - 1) {
      res += v[r];
    }
    return res;
  }
};
int main() {
  long long n, l, i, x, k;
  cin >> n >> k;
  BIT btree[20];
  for (i = 0; i < 20; i++) {
    btree[i].init(n + 70);
  }
  long long a[70] = {0};
  for (i = 0; i < n; i++) {
    cin >> x;
    for (l = k + 1; l >= 2; l--) {
      btree[l].upd(x, btree[l - 1].sum(x - 1));
    }
    btree[1].upd(x, 1);
  }
  cout << btree[k + 1].sum(n);
  return 0;
}

```