#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 2;
long long bit[MAX][11];
long long get(int x, int id) {
  long long ans = 0;
  for (; x > 0; x -= -x & x) {
    ans += bit[x][id];
  }
  return ans;
}
void update(int x, long long v, int id) {
  for (; x < MAX; x += -x & x) {
    bit[x][id] += v;
  }
}
int main() {
  int n, k;
  cin >> n >> k;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    for (int j = 1; j <= k; j++) {
      long long v = get(x - 1, j);
      if (j == k)
        ans += v;
      else
        update(x, v, j + 1);
    }
    update(x, 1, 1);
  }
  if (k == 0) ans = n;
  cout << ans << '\n';
}

### Prompt

In CPP, your task is to solve 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;
const int MAX = 1e5 + 2;
long long bit[MAX][11];
long long get(int x, int id) {
  long long ans = 0;
  for (; x > 0; x -= -x & x) {
    ans += bit[x][id];
  }
  return ans;
}
void update(int x, long long v, int id) {
  for (; x < MAX; x += -x & x) {
    bit[x][id] += v;
  }
}
int main() {
  int n, k;
  cin >> n >> k;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    for (int j = 1; j <= k; j++) {
      long long v = get(x - 1, j);
      if (j == k)
        ans += v;
      else
        update(x, v, j + 1);
    }
    update(x, 1, 1);
  }
  if (k == 0) ans = n;
  cout << ans << '\n';
}

```