#include <bits/stdc++.h>
using namespace std;
long long tree[12][100010];
long long read(int fg, long long idx) {
  long long sum = 0;
  while (idx > 0) {
    sum += tree[fg][idx];
    idx -= (idx & -idx);
  }
  return sum;
}
void update(int fg, int idx, long long val) {
  while (idx <= 100009) {
    tree[fg][idx] += val;
    idx += (idx & -idx);
  }
}
int main() {
  int n, k, f = 0;
  cin >> n >> k;
  long long arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int j = 0; j < n; j++) {
    for (int i = 1; i <= k + 1; i++) {
      if (i == 1)
        update(1, arr[j], 1);
      else
        update(i, arr[j], read(i - 1, arr[j] - 1));
    }
  }
  cout << read(k + 1, 100009);
  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;
long long tree[12][100010];
long long read(int fg, long long idx) {
  long long sum = 0;
  while (idx > 0) {
    sum += tree[fg][idx];
    idx -= (idx & -idx);
  }
  return sum;
}
void update(int fg, int idx, long long val) {
  while (idx <= 100009) {
    tree[fg][idx] += val;
    idx += (idx & -idx);
  }
}
int main() {
  int n, k, f = 0;
  cin >> n >> k;
  long long arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int j = 0; j < n; j++) {
    for (int i = 1; i <= k + 1; i++) {
      if (i == 1)
        update(1, arr[j], 1);
      else
        update(i, arr[j], read(i - 1, arr[j] - 1));
    }
  }
  cout << read(k + 1, 100009);
  return 0;
}

```