#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
int a[N + 1];
long long d[N + 1][12];
struct ST {
  int n;
  long long *t;
  void build(int N) {
    n = N;
    t = new long long[2 * n]();
  }
  void update(int pos, long long val) {
    t[pos += n] = val;
    for (pos >>= 1; pos > 0; pos >>= 1) {
      t[pos] = t[pos << 1] + t[(pos << 1) + 1];
    }
  }
  long long get(int l, int r) {
    if (l > r) return 0;
    long long res = 0;
    for (l += n, r += n; l <= r; l >>= 1, r >>= 1) {
      if (l & 1) res += t[l++];
      if ((r & 1) == 0) res += t[r--];
    }
    return res;
  }
} s[12];
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i <= 11; i++) {
    s[i].build(n);
  }
  d[0][1] = 1;
  s[1].update(a[0] - 1, 1);
  for (int i = 1; i < n; i++) {
    d[i][1] = 1;
    s[1].update(a[i] - 1, 1);
    for (int j = 2; j <= k + 1; j++) {
      d[i][j] = s[j - 1].get(0, a[i] - 2);
      s[j].update(a[i] - 1, d[i][j]);
    }
  }
  cout << s[k + 1].get(0, n - 1);
  return 0;
}

### Prompt

Construct a Cpp code solution to the problem outlined:

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 int N = 1e5;
int a[N + 1];
long long d[N + 1][12];
struct ST {
  int n;
  long long *t;
  void build(int N) {
    n = N;
    t = new long long[2 * n]();
  }
  void update(int pos, long long val) {
    t[pos += n] = val;
    for (pos >>= 1; pos > 0; pos >>= 1) {
      t[pos] = t[pos << 1] + t[(pos << 1) + 1];
    }
  }
  long long get(int l, int r) {
    if (l > r) return 0;
    long long res = 0;
    for (l += n, r += n; l <= r; l >>= 1, r >>= 1) {
      if (l & 1) res += t[l++];
      if ((r & 1) == 0) res += t[r--];
    }
    return res;
  }
} s[12];
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i <= 11; i++) {
    s[i].build(n);
  }
  d[0][1] = 1;
  s[1].update(a[0] - 1, 1);
  for (int i = 1; i < n; i++) {
    d[i][1] = 1;
    s[1].update(a[i] - 1, 1);
    for (int j = 2; j <= k + 1; j++) {
      d[i][j] = s[j - 1].get(0, a[i] - 2);
      s[j].update(a[i] - 1, d[i][j]);
    }
  }
  cout << s[k + 1].get(0, n - 1);
  return 0;
}

```