#include <bits/stdc++.h>
using namespace std;
long long dp[11][100001];
int n, m;
long long a[11][100001];
int b[100001];
long long sum(int x, int y) {
  long long ans = 1;
  for (int i = 0; i < y; ++i) ans = ans * (long long)(x - i) / (i + 1);
  return ans;
}
int lowbit(int x) { return x & (-x); }
void modify(int x, long long add, int k) {
  while (x <= n) {
    a[k][x] += add;
    x += lowbit(x);
  }
}
long long get_sum(int x, int k) {
  long long ret = 0;
  while (x != 0) {
    ret += a[k][x];
    x -= lowbit(x);
  }
  return ret;
}
void solve() {
  memset(a, 0, sizeof(0));
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    modify(b[i], 1, 1);
    for (int j = 2; j <= m; j++) {
      long long sum = get_sum(b[i] - 1, j - 1);
      modify(b[i], sum, j);
    }
    ans += get_sum(b[i] - 1, m);
  }
  cout << ans << endl;
}
int main() {
  while (cin >> n >> m) {
    for (int i = 0; i < n; ++i) scanf("%d", &b[i]);
    if (m == 0)
      cout << "1" << endl;
    else
      solve();
  }
  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;
long long dp[11][100001];
int n, m;
long long a[11][100001];
int b[100001];
long long sum(int x, int y) {
  long long ans = 1;
  for (int i = 0; i < y; ++i) ans = ans * (long long)(x - i) / (i + 1);
  return ans;
}
int lowbit(int x) { return x & (-x); }
void modify(int x, long long add, int k) {
  while (x <= n) {
    a[k][x] += add;
    x += lowbit(x);
  }
}
long long get_sum(int x, int k) {
  long long ret = 0;
  while (x != 0) {
    ret += a[k][x];
    x -= lowbit(x);
  }
  return ret;
}
void solve() {
  memset(a, 0, sizeof(0));
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    modify(b[i], 1, 1);
    for (int j = 2; j <= m; j++) {
      long long sum = get_sum(b[i] - 1, j - 1);
      modify(b[i], sum, j);
    }
    ans += get_sum(b[i] - 1, m);
  }
  cout << ans << endl;
}
int main() {
  while (cin >> n >> m) {
    for (int i = 0; i < n; ++i) scanf("%d", &b[i]);
    if (m == 0)
      cout << "1" << endl;
    else
      solve();
  }
  return 0;
}

```