#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + (c ^ 48);
    c = getchar();
  }
  return x * f;
}
inline void write(long long x) {
  if (x < 0) x = -x, putchar('-');
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
const int maxn = 1e5 + 5;
int a[maxn], n, k;
long long f[maxn][12], ans, tmp;
int lowbit(int x) { return x & -x; }
void add(int i, int j, long long x) {
  for (int c = i; c <= n; c += lowbit(c)) f[c][j] += x;
}
long long ask(int i, int j) {
  long long res = 0;
  for (int c = i; c; c -= lowbit(c)) res += f[c][j];
  return res;
}
int main() {
  n = read(), k = read(), k++;
  memset(f, 0, sizeof(f));
  for (int i = (1); i <= (n); ++i) a[i] = read();
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      if (j > 1)
        add(a[i], j, ask(a[i] - 1, j - 1));
      else
        add(a[i], j, 1);
    }
  }
  write(ask(n, k));
  return 0;
}

### Prompt

Please create a solution in cpp 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;
inline long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + (c ^ 48);
    c = getchar();
  }
  return x * f;
}
inline void write(long long x) {
  if (x < 0) x = -x, putchar('-');
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
const int maxn = 1e5 + 5;
int a[maxn], n, k;
long long f[maxn][12], ans, tmp;
int lowbit(int x) { return x & -x; }
void add(int i, int j, long long x) {
  for (int c = i; c <= n; c += lowbit(c)) f[c][j] += x;
}
long long ask(int i, int j) {
  long long res = 0;
  for (int c = i; c; c -= lowbit(c)) res += f[c][j];
  return res;
}
int main() {
  n = read(), k = read(), k++;
  memset(f, 0, sizeof(f));
  for (int i = (1); i <= (n); ++i) a[i] = read();
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      if (j > 1)
        add(a[i], j, ask(a[i] - 1, j - 1));
      else
        add(a[i], j, 1);
    }
  }
  write(ask(n, k));
  return 0;
}

```