#include <bits/stdc++.h>
using namespace std;
const long long N = 100100;
long long a[N], b[15][N];
void add(long long i, long long j, long long x) {
  while (j < N) b[i][j] += x, j += (j & -j);
}
long long sum(long long i, long long j) {
  long long s = 0;
  while (j > 0) {
    s += b[i][j];
    j -= (j & -j);
  }
  return s;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n, k;
  cin >> n >> k;
  k++;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      if (j == 1)
        add(j, a[i], 1);
      else {
        long long x = sum(j - 1, a[i] - 1);
        add(j, a[i], x);
      }
    }
  }
  cout << sum(k, n) << "\n";
}

### Prompt

Construct a Cpp code solution to the problem outlined:

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 long long N = 100100;
long long a[N], b[15][N];
void add(long long i, long long j, long long x) {
  while (j < N) b[i][j] += x, j += (j & -j);
}
long long sum(long long i, long long j) {
  long long s = 0;
  while (j > 0) {
    s += b[i][j];
    j -= (j & -j);
  }
  return s;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n, k;
  cin >> n >> k;
  k++;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      if (j == 1)
        add(j, a[i], 1);
      else {
        long long x = sum(j - 1, a[i] - 1);
        add(j, a[i], x);
      }
    }
  }
  cout << sum(k, n) << "\n";
}

```