#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
const int dr[] = {-1, 1, 0, 0, -1, -1, 1, 1};
const int dc[] = {0, 0, 1, -1, -1, 1, -1, 1};
const int MOD = 1e9 + 7;
const int INF = 1e9;
const long double pi = acos(-1);
const double eps = 1e-9;
const int N = 1e5 + 5;
int T;
long long st[4 * N][13], dp[4 * N][13], ans;
long long n, k;
pair<long long, long long> a[N];
void update(int ss, int second, int idx, int idxnow, int pos, long long val) {
  if (ss > idxnow || second < idxnow) return;
  if (ss == second && ss == idxnow) {
    st[idx][pos] = val;
    return;
  }
  int mid = (ss + second) / 2;
  update(ss, mid, idx * 2, idxnow, pos, val);
  update(mid + 1, second, idx * 2 + 1, idxnow, pos, val);
  st[idx][pos] = st[idx * 2][pos] + st[idx * 2 + 1][pos];
}
long long query(int ss, int second, int idx, int idxnow, int pos) {
  if (ss > idxnow) return 0;
  if (second <= idxnow) {
    return st[idx][pos];
  }
  int mid = (ss + second) / 2;
  long long left = query(ss, mid, idx * 2, idxnow, pos);
  long long right = query(mid + 1, second, idx * 2 + 1, idxnow, pos);
  return left + right;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  T = 1;
  while (T--) {
    cin >> n >> k;
    for (int i = 1; i <= n; i++) {
      cin >> a[i].first;
      a[i].second = i;
    }
    sort(a + 1, a + 1 + n);
    for (int i = 1; i <= n; i++) {
      int idxnow = a[i].second;
      dp[i][1] = 1;
      update(1, n, 1, idxnow, 1, dp[i][1]);
      for (int j = 2; j <= k + 1; j++) {
        long long cnt = query(1, n, 1, idxnow - 1, j - 1);
        dp[i][j] = cnt;
        update(1, n, 1, idxnow, j, dp[i][j]);
      }
    }
    for (int i = 1; i <= n; i++) {
      ans += dp[i][k + 1];
    }
    cout << ans << '\n';
  }
  return 0;
}

### Prompt

Your task is to create 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;
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
const int dr[] = {-1, 1, 0, 0, -1, -1, 1, 1};
const int dc[] = {0, 0, 1, -1, -1, 1, -1, 1};
const int MOD = 1e9 + 7;
const int INF = 1e9;
const long double pi = acos(-1);
const double eps = 1e-9;
const int N = 1e5 + 5;
int T;
long long st[4 * N][13], dp[4 * N][13], ans;
long long n, k;
pair<long long, long long> a[N];
void update(int ss, int second, int idx, int idxnow, int pos, long long val) {
  if (ss > idxnow || second < idxnow) return;
  if (ss == second && ss == idxnow) {
    st[idx][pos] = val;
    return;
  }
  int mid = (ss + second) / 2;
  update(ss, mid, idx * 2, idxnow, pos, val);
  update(mid + 1, second, idx * 2 + 1, idxnow, pos, val);
  st[idx][pos] = st[idx * 2][pos] + st[idx * 2 + 1][pos];
}
long long query(int ss, int second, int idx, int idxnow, int pos) {
  if (ss > idxnow) return 0;
  if (second <= idxnow) {
    return st[idx][pos];
  }
  int mid = (ss + second) / 2;
  long long left = query(ss, mid, idx * 2, idxnow, pos);
  long long right = query(mid + 1, second, idx * 2 + 1, idxnow, pos);
  return left + right;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  T = 1;
  while (T--) {
    cin >> n >> k;
    for (int i = 1; i <= n; i++) {
      cin >> a[i].first;
      a[i].second = i;
    }
    sort(a + 1, a + 1 + n);
    for (int i = 1; i <= n; i++) {
      int idxnow = a[i].second;
      dp[i][1] = 1;
      update(1, n, 1, idxnow, 1, dp[i][1]);
      for (int j = 2; j <= k + 1; j++) {
        long long cnt = query(1, n, 1, idxnow - 1, j - 1);
        dp[i][j] = cnt;
        update(1, n, 1, idxnow, j, dp[i][j]);
      }
    }
    for (int i = 1; i <= n; i++) {
      ans += dp[i][k + 1];
    }
    cout << ans << '\n';
  }
  return 0;
}

```