#include <bits/stdc++.h>
using namespace std;
const long long int MAXN = 1e5 + 5;
long long int a[MAXN];
long long int N, K;
long long int bit[12][MAXN];
void update(long long int pos, long long int idx, long long int val) {
  while (pos < MAXN) {
    bit[idx][pos] += val;
    pos += (pos & -pos);
  }
}
long long int query(long long int pos, long long int idx) {
  long long int ans = 0;
  while (pos) {
    ans = ans + bit[idx][pos];
    pos -= (pos & -pos);
  }
  return ans;
}
signed main() {
  cin >> N >> K;
  ++K;
  for (long long int i = 1; i <= N; ++i) cin >> a[i];
  for (long long int i = 1; i <= N; ++i) {
    update(a[i], 1, 1);
    for (long long int j = 2; j <= K; ++j) {
      long long int val = query(a[i] - 1, j - 1);
      update(a[i], j, val);
    }
  }
  cout << query(MAXN - 1, K);
}

### 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;
const long long int MAXN = 1e5 + 5;
long long int a[MAXN];
long long int N, K;
long long int bit[12][MAXN];
void update(long long int pos, long long int idx, long long int val) {
  while (pos < MAXN) {
    bit[idx][pos] += val;
    pos += (pos & -pos);
  }
}
long long int query(long long int pos, long long int idx) {
  long long int ans = 0;
  while (pos) {
    ans = ans + bit[idx][pos];
    pos -= (pos & -pos);
  }
  return ans;
}
signed main() {
  cin >> N >> K;
  ++K;
  for (long long int i = 1; i <= N; ++i) cin >> a[i];
  for (long long int i = 1; i <= N; ++i) {
    update(a[i], 1, 1);
    for (long long int j = 2; j <= K; ++j) {
      long long int val = query(a[i] - 1, j - 1);
      update(a[i], j, val);
    }
  }
  cout << query(MAXN - 1, K);
}

```