#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 1;
long long a[N], sgt[4 * N];
long long dp[N][2];
long long n, k, zero;
void update(long long node, long long l, long long r, long long x,
            long long val) {
  if (l > r) return;
  if (l == r) {
    sgt[node] = val;
    return;
  }
  long long mid = (l + r) / 2;
  if (x <= mid)
    update(2 * node, l, mid, x, val);
  else
    update(2 * node + 1, mid + 1, r, x, val);
  sgt[node] = sgt[2 * node] + sgt[2 * node + 1];
  return;
}
long long query(long long node, long long l, long long r, long long ql,
                long long qr) {
  if (l > r || ql > qr) return 0;
  if (l > qr || r < ql) return 0;
  if (l >= ql && r <= qr) return sgt[node];
  long long mid = (l + r) / 2;
  return query(2 * node, l, mid, ql, qr) +
         query(2 * node + 1, mid + 1, r, ql, qr);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 1; i <= n; i++) dp[i][1] = 1;
  for (long long j = 2; j <= k + 1; j++) {
    for (long long i = 1; i <= n; i++) {
      dp[i][j % 2] = query(1, 1, n, 1, a[i] - 1);
      update(1, 1, n, a[i], dp[i][(j - 1) % 2]);
    }
    for (long long i = 1; i <= n; i++) update(1, 1, n, i, zero);
  }
  long long ans = 0;
  for (long long i = 1; i <= n; i++) ans = ans + dp[i][(k + 1) % 2];
  cout << ans;
  return 0;
}

### Prompt

Please provide a Cpp coded solution to the problem described below:

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 = 1e5 + 1;
long long a[N], sgt[4 * N];
long long dp[N][2];
long long n, k, zero;
void update(long long node, long long l, long long r, long long x,
            long long val) {
  if (l > r) return;
  if (l == r) {
    sgt[node] = val;
    return;
  }
  long long mid = (l + r) / 2;
  if (x <= mid)
    update(2 * node, l, mid, x, val);
  else
    update(2 * node + 1, mid + 1, r, x, val);
  sgt[node] = sgt[2 * node] + sgt[2 * node + 1];
  return;
}
long long query(long long node, long long l, long long r, long long ql,
                long long qr) {
  if (l > r || ql > qr) return 0;
  if (l > qr || r < ql) return 0;
  if (l >= ql && r <= qr) return sgt[node];
  long long mid = (l + r) / 2;
  return query(2 * node, l, mid, ql, qr) +
         query(2 * node + 1, mid + 1, r, ql, qr);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 1; i <= n; i++) dp[i][1] = 1;
  for (long long j = 2; j <= k + 1; j++) {
    for (long long i = 1; i <= n; i++) {
      dp[i][j % 2] = query(1, 1, n, 1, a[i] - 1);
      update(1, 1, n, a[i], dp[i][(j - 1) % 2]);
    }
    for (long long i = 1; i <= n; i++) update(1, 1, n, i, zero);
  }
  long long ans = 0;
  for (long long i = 1; i <= n; i++) ans = ans + dp[i][(k + 1) % 2];
  cout << ans;
  return 0;
}

```