#include <bits/stdc++.h>
using namespace std;
int a[1000006], n;
unsigned long long tree[15][1000006];
void update(int x, unsigned long long delta, int k) {
  for (; x <= n; x += x & -x) tree[k][x] += delta;
}
unsigned long long sum(int x, int k) {
  unsigned long long val = 0;
  for (; x > 0; x -= x & -x) val += tree[k][x];
  return val;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int k, i, j;
  unsigned long long p1;
  cin >> n >> k;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = 1; i <= n; i++) {
    update(a[i], 1, 1);
    for (j = 2; j <= (k + 1); j++) {
      p1 = sum(a[i] - 1, j - 1);
      update(a[i], p1, j);
    }
  }
  cout << (unsigned long long)sum(n, k + 1);
  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 a[1000006], n;
unsigned long long tree[15][1000006];
void update(int x, unsigned long long delta, int k) {
  for (; x <= n; x += x & -x) tree[k][x] += delta;
}
unsigned long long sum(int x, int k) {
  unsigned long long val = 0;
  for (; x > 0; x -= x & -x) val += tree[k][x];
  return val;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int k, i, j;
  unsigned long long p1;
  cin >> n >> k;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = 1; i <= n; i++) {
    update(a[i], 1, 1);
    for (j = 2; j <= (k + 1); j++) {
      p1 = sum(a[i] - 1, j - 1);
      update(a[i], p1, j);
    }
  }
  cout << (unsigned long long)sum(n, k + 1);
  return 0;
}

```