#include <bits/stdc++.h>
using namespace std;
int n, k, a[100005];
long long F[100005][15], ft[100005];
void update(int x, long long k) {
  for (; x <= n; x += x & -x) ft[x] += k;
}
long long retrieve(int x) {
  long long res = 0;
  for (; x; x -= x & -x) res += ft[x];
  return res;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    F[i][1] = 1;
  }
  if (!k) {
    cout << n;
    return 0;
  }
  for (int j = 2; j <= k + 1; ++j) {
    memset(ft, 0, sizeof ft);
    for (int i = 1; i <= n; ++i) {
      F[i][j] = retrieve(a[i] - 1);
      update(a[i], F[i][j - 1]);
    }
  }
  long long res = 0;
  for (int i = 1; i <= n; ++i) res += F[i][k + 1];
  cout << res;
  return 0;
}

### Prompt

In Cpp, your task is to solve 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;
int n, k, a[100005];
long long F[100005][15], ft[100005];
void update(int x, long long k) {
  for (; x <= n; x += x & -x) ft[x] += k;
}
long long retrieve(int x) {
  long long res = 0;
  for (; x; x -= x & -x) res += ft[x];
  return res;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    F[i][1] = 1;
  }
  if (!k) {
    cout << n;
    return 0;
  }
  for (int j = 2; j <= k + 1; ++j) {
    memset(ft, 0, sizeof ft);
    for (int i = 1; i <= n; ++i) {
      F[i][j] = retrieve(a[i] - 1);
      update(a[i], F[i][j - 1]);
    }
  }
  long long res = 0;
  for (int i = 1; i <= n; ++i) res += F[i][k + 1];
  cout << res;
  return 0;
}

```