#include <bits/stdc++.h>
using namespace std;
int T;
const int N = 120000;
int n, k;
struct BIT {
  long long c[N];
  BIT() { memset(c, 0, sizeof(c)); }
  void init() {
    for (int i = 0; i <= n; ++i) c[i] = 0;
  }
  int lowbit(int x) { return x & (-x); }
  void updata(int pos, long long x) {
    while (pos <= n) {
      c[pos] += x;
      pos += lowbit(pos);
    }
  }
  long long sum(int pos) {
    long long ans = 0;
    while (pos) {
      ans += c[pos];
      pos -= lowbit(pos);
    }
    return ans;
  }
};
int a[120000];
long long dp;
BIT t[20];
int main() {
  while (scanf("%d%d", &n, &k) != EOF) {
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
    }
    k++;
    int ans = 0;
    for (int i = 1; i <= k; ++i) t[i].init();
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= k; j++) {
        dp = t[j - 1].sum(a[i] - 1);
        if (j == 1) dp++;
        t[j].updata(a[i], dp);
      }
    }
    printf("%I64d\n", t[k].sum(n));
  }
  return 0;
}

### Prompt

Generate 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;
int T;
const int N = 120000;
int n, k;
struct BIT {
  long long c[N];
  BIT() { memset(c, 0, sizeof(c)); }
  void init() {
    for (int i = 0; i <= n; ++i) c[i] = 0;
  }
  int lowbit(int x) { return x & (-x); }
  void updata(int pos, long long x) {
    while (pos <= n) {
      c[pos] += x;
      pos += lowbit(pos);
    }
  }
  long long sum(int pos) {
    long long ans = 0;
    while (pos) {
      ans += c[pos];
      pos -= lowbit(pos);
    }
    return ans;
  }
};
int a[120000];
long long dp;
BIT t[20];
int main() {
  while (scanf("%d%d", &n, &k) != EOF) {
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
    }
    k++;
    int ans = 0;
    for (int i = 1; i <= k; ++i) t[i].init();
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= k; j++) {
        dp = t[j - 1].sum(a[i] - 1);
        if (j == 1) dp++;
        t[j].updata(a[i], dp);
      }
    }
    printf("%I64d\n", t[k].sum(n));
  }
  return 0;
}

```