#include <bits/stdc++.h>
using namespace std;
long long b[11][100005];
void update(int pos, int treeno, long long val) {
  while (pos <= 100001) {
    b[treeno][pos] += val;
    pos += (pos & (-pos));
  }
}
long long query(int pos, int treeno) {
  long long sum = 0;
  for (int i = pos; i > 0; i -= (i & (-i))) sum += b[treeno][i];
  return sum;
}
void print() {
  for (int i = 0; i < 5; i++)
    for (int j = 0; j < 10; j++) cout << b[i][j] << " \n"[j == 9];
}
int main() {
  int n, k;
  scanf("%d", &n);
  scanf("%d", &k);
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    for (int i = k; i > 0; i--) {
      update(x, i, query(x, i - 1));
    }
    update(x, 0, 1);
  }
  cout << query(n, k) << endl;
  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;
long long b[11][100005];
void update(int pos, int treeno, long long val) {
  while (pos <= 100001) {
    b[treeno][pos] += val;
    pos += (pos & (-pos));
  }
}
long long query(int pos, int treeno) {
  long long sum = 0;
  for (int i = pos; i > 0; i -= (i & (-i))) sum += b[treeno][i];
  return sum;
}
void print() {
  for (int i = 0; i < 5; i++)
    for (int j = 0; j < 10; j++) cout << b[i][j] << " \n"[j == 9];
}
int main() {
  int n, k;
  scanf("%d", &n);
  scanf("%d", &k);
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    for (int i = k; i > 0; i--) {
      update(x, i, query(x, i - 1));
    }
    update(x, 0, 1);
  }
  cout << query(n, k) << endl;
  return 0;
}

```