#include <bits/stdc++.h>
using namespace std;
long long int dif(long long int a, long long int b) {
  return ((a / b) + (a % b != 0));
}
long long int n, ans, st[12][400400], k, v;
long long int a[100100];
void upd(long long int n, long long int l, long long int r, long long int x,
         long long int v, long long int len) {
  if (x > r || x < l) return;
  if (l == x && r == x) {
    st[len][n] += v;
    return;
  }
  long long int mid = (r + l) / 2;
  upd(2 * n, l, mid, x, v, len);
  upd(2 * n + 1, mid + 1, r, x, v, len);
  st[len][n] = st[len][2 * n] + st[len][2 * n + 1];
}
long long int qry(long long int n, long long int l, long long int r,
                  long long int f, long long int t, long long int len) {
  if (f > r || t < l) return 0;
  if (l >= f && r <= t) return st[len][n];
  long long int mid = (r + l) / 2;
  long long int s1 = qry(2 * n, l, mid, f, t, len);
  long long int s2 = qry(2 * n + 1, mid + 1, r, f, t, len);
  return s1 + s2;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < k + 1; j++) {
      v = qry(1, 1, n, 1, a[i] - 1, j);
      if (j == 0) v = 1;
      upd(1, 1, n, a[i], v, j + 1);
    }
  }
  cout << st[k + 1][1];
  return 0;
}

### Prompt

Your challenge is to write 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 int dif(long long int a, long long int b) {
  return ((a / b) + (a % b != 0));
}
long long int n, ans, st[12][400400], k, v;
long long int a[100100];
void upd(long long int n, long long int l, long long int r, long long int x,
         long long int v, long long int len) {
  if (x > r || x < l) return;
  if (l == x && r == x) {
    st[len][n] += v;
    return;
  }
  long long int mid = (r + l) / 2;
  upd(2 * n, l, mid, x, v, len);
  upd(2 * n + 1, mid + 1, r, x, v, len);
  st[len][n] = st[len][2 * n] + st[len][2 * n + 1];
}
long long int qry(long long int n, long long int l, long long int r,
                  long long int f, long long int t, long long int len) {
  if (f > r || t < l) return 0;
  if (l >= f && r <= t) return st[len][n];
  long long int mid = (r + l) / 2;
  long long int s1 = qry(2 * n, l, mid, f, t, len);
  long long int s2 = qry(2 * n + 1, mid + 1, r, f, t, len);
  return s1 + s2;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < k + 1; j++) {
      v = qry(1, 1, n, 1, a[i] - 1, j);
      if (j == 0) v = 1;
      upd(1, 1, n, a[i], v, j + 1);
    }
  }
  cout << st[k + 1][1];
  return 0;
}

```