#include <bits/stdc++.h>
using namespace ::std;
const long long maxn = 1e5 + 500;
const long long mod = 1e9 + 7;
const long long inf = 1e9 + 500;
long long fen[maxn][12];
long long a[maxn];
void update(long long x, long long k, long long val) {
  x++;
  while (x < maxn) {
    fen[x][k] += val;
    x += (x & (-x));
  }
}
long long finds(long long x, long long k) {
  x++;
  long long ans = 0;
  while (x > 0) {
    ans += fen[x][k];
    x -= (x & (-x));
  }
  return ans;
}
int main() {
  long long n, k;
  cin >> n >> k;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; i++) {
    update(a[i], 1LL, 1LL);
    for (long long j = 2; j <= k + 1; j++) {
      update(a[i], j, finds(a[i] - 1, j - 1));
    }
  }
  cout << finds((long long)(1e5), k + 1);
}

### Prompt

Develop a solution in cpp 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 maxn = 1e5 + 500;
const long long mod = 1e9 + 7;
const long long inf = 1e9 + 500;
long long fen[maxn][12];
long long a[maxn];
void update(long long x, long long k, long long val) {
  x++;
  while (x < maxn) {
    fen[x][k] += val;
    x += (x & (-x));
  }
}
long long finds(long long x, long long k) {
  x++;
  long long ans = 0;
  while (x > 0) {
    ans += fen[x][k];
    x -= (x & (-x));
  }
  return ans;
}
int main() {
  long long n, k;
  cin >> n >> k;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; i++) {
    update(a[i], 1LL, 1LL);
    for (long long j = 2; j <= k + 1; j++) {
      update(a[i], j, finds(a[i] - 1, j - 1));
    }
  }
  cout << finds((long long)(1e5), k + 1);
}

```