#include <bits/stdc++.h>
long long lmax(long long o, long long w) {
  if (o > w) return o;
  return w;
}
long long lmin(long long o, long long w) {
  if (o < w) return o;
  return w;
}
using namespace std;
int n, k, cmax = 2 * 10e4;
long long a[300003], tree[12][300003];
long long fakt, ans;
void update(int q, int indx, long long x) {
  while (indx <= cmax) {
    tree[q][indx] += x;
    indx += (indx & -indx);
  }
}
long long read(int q, int indx) {
  long long sum = 0;
  while (indx > 0) {
    sum += tree[q][indx];
    indx -= (indx & -indx);
  }
  return sum;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  ;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    for (int j = k + 1; j >= 2; j--) {
      long long x = read(j - 1, a[i]);
      update(j, a[i], x);
    }
    update(1, a[i], 1);
  }
  for (int i = 1; i <= n; i++) {
    fakt = (long long)read(k + 1, a[i]);
    ans = lmax(ans, fakt);
  }
  cout << ans << endl;
}

### Prompt

Create a solution in cpp for 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>
long long lmax(long long o, long long w) {
  if (o > w) return o;
  return w;
}
long long lmin(long long o, long long w) {
  if (o < w) return o;
  return w;
}
using namespace std;
int n, k, cmax = 2 * 10e4;
long long a[300003], tree[12][300003];
long long fakt, ans;
void update(int q, int indx, long long x) {
  while (indx <= cmax) {
    tree[q][indx] += x;
    indx += (indx & -indx);
  }
}
long long read(int q, int indx) {
  long long sum = 0;
  while (indx > 0) {
    sum += tree[q][indx];
    indx -= (indx & -indx);
  }
  return sum;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  ;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    for (int j = k + 1; j >= 2; j--) {
      long long x = read(j - 1, a[i]);
      update(j, a[i], x);
    }
    update(1, a[i], 1);
  }
  for (int i = 1; i <= n; i++) {
    fakt = (long long)read(k + 1, a[i]);
    ans = lmax(ans, fakt);
  }
  cout << ans << endl;
}

```