#include <bits/stdc++.h>
using namespace std;
long long n, k;
long long a[105904], f[105904][15], t[105904][15];
inline long long lowbit(long long x);
inline long long query(long long x, long long j);
inline void adds(long long x, long long y, long long j);
signed main() {
  cin >> n >> k;
  for (register long long i = 1; i <= n; i++) cin >> a[i];
  for (register long long i = 1; i <= n; i++) {
    adds(a[i], 1, 1);
    for (register long long j = 2; j <= k + 1; j++)
      f[i][j] = query(a[i] - 1, j - 1), adds(a[i], f[i][j], j);
  }
  long long ans = 0;
  for (register long long i = 1; i <= n; i++) ans += f[i][k + 1];
  if (k == 0) ans++;
  cout << ans;
  return 0;
}
inline void adds(long long x, long long y, long long j) {
  for (register long long i = x; i <= n; i += lowbit(i)) t[i][j] += y;
  return;
}
inline long long query(long long x, long long j) {
  long long tot = 0;
  for (register long long i = x; i; i -= lowbit(i)) tot += t[i][j];
  return tot;
}
inline long long lowbit(long long x) { return x & (-x); }

### Prompt

Please provide a CPP coded solution 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;
long long n, k;
long long a[105904], f[105904][15], t[105904][15];
inline long long lowbit(long long x);
inline long long query(long long x, long long j);
inline void adds(long long x, long long y, long long j);
signed main() {
  cin >> n >> k;
  for (register long long i = 1; i <= n; i++) cin >> a[i];
  for (register long long i = 1; i <= n; i++) {
    adds(a[i], 1, 1);
    for (register long long j = 2; j <= k + 1; j++)
      f[i][j] = query(a[i] - 1, j - 1), adds(a[i], f[i][j], j);
  }
  long long ans = 0;
  for (register long long i = 1; i <= n; i++) ans += f[i][k + 1];
  if (k == 0) ans++;
  cout << ans;
  return 0;
}
inline void adds(long long x, long long y, long long j) {
  for (register long long i = x; i <= n; i += lowbit(i)) t[i][j] += y;
  return;
}
inline long long query(long long x, long long j) {
  long long tot = 0;
  for (register long long i = x; i; i -= lowbit(i)) tot += t[i][j];
  return tot;
}
inline long long lowbit(long long x) { return x & (-x); }

```