#include <bits/stdc++.h>
using namespace std;
long long int a[100010];
long long int tree[13][100006];
long long int dp[100005][13];
void update(long long int x, long long int len, long long int val) {
  while (x <= 100000) {
    tree[len][x] += val;
    x += (x & -x);
  }
}
long long int query(long long int x, long long int len) {
  long long int sum = 0LL;
  while (x > 0) {
    sum += tree[len][x];
    x -= (x & -x);
  }
  return sum;
}
int main() {
  long long int n, m, ans = 0LL, i, j;
  cin >> n >> m;
  for (i = 1; i <= n; i++) cin >> a[i];
  memset(tree, 0LL, sizeof tree);
  if (m > n) {
    cout << 0;
    return 0;
  }
  for (i = 1; i <= n; ++i) {
    dp[i][1] = 1LL;
  }
  for (i = 1; i <= n; ++i) {
    update(a[i], 1, 1);
    for (j = 2; j <= m + 1; ++j) {
      long long int cur = query(a[i] - 1, j - 1);
      dp[i][j] += cur;
      update(a[i], j, cur);
    }
  }
  for (i = 1; i <= n; ++i) {
    ans += dp[i][m + 1];
  }
  cout << ans << endl;
  return 0;
}

### Prompt

Please formulate 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 a[100010];
long long int tree[13][100006];
long long int dp[100005][13];
void update(long long int x, long long int len, long long int val) {
  while (x <= 100000) {
    tree[len][x] += val;
    x += (x & -x);
  }
}
long long int query(long long int x, long long int len) {
  long long int sum = 0LL;
  while (x > 0) {
    sum += tree[len][x];
    x -= (x & -x);
  }
  return sum;
}
int main() {
  long long int n, m, ans = 0LL, i, j;
  cin >> n >> m;
  for (i = 1; i <= n; i++) cin >> a[i];
  memset(tree, 0LL, sizeof tree);
  if (m > n) {
    cout << 0;
    return 0;
  }
  for (i = 1; i <= n; ++i) {
    dp[i][1] = 1LL;
  }
  for (i = 1; i <= n; ++i) {
    update(a[i], 1, 1);
    for (j = 2; j <= m + 1; ++j) {
      long long int cur = query(a[i] - 1, j - 1);
      dp[i][j] += cur;
      update(a[i], j, cur);
    }
  }
  for (i = 1; i <= n; ++i) {
    ans += dp[i][m + 1];
  }
  cout << ans << endl;
  return 0;
}

```