#include <bits/stdc++.h>
using namespace std;
inline int read();
const int N = 1e5 + 10;
int n, k, a[N];
long long ans, dp[N][20];
struct tree {
  long long c[N];
  tree() { memset(c, 0, sizeof(c)); }
  inline void add(int x, long long y) {
    while (x <= n) {
      c[x] += y;
      x += x & -x;
    }
  }
  inline long long query(int x) {
    long long s = 0;
    while (x) {
      s += c[x];
      x -= x & -x;
    }
    return s;
  }
} b[20];
int main() {
  n = read(), k = read();
  for (register int i = 1; i <= n; i++) a[i] = read();
  for (register int i = 1; i <= n; i++) {
    b[1].add(a[i], 1);
    for (register int j = 2; j <= k + 1; j++) {
      dp[i][j] = b[j - 1].query(a[i] - 1);
      b[j].add(a[i], dp[i][j]);
    }
  }
  for (register int i = 1; i <= n; i++) ans += dp[i][k + 1];
  printf("%lld", ans + (!k));
  return 0;
}
inline int read() {
  register int x = 0, f = 1;
  register char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 3) + (x << 1) + (c ^ 48);
    c = getchar();
  }
  return x * f;
}

### Prompt

Create a solution in Cpp for 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 int read();
const int N = 1e5 + 10;
int n, k, a[N];
long long ans, dp[N][20];
struct tree {
  long long c[N];
  tree() { memset(c, 0, sizeof(c)); }
  inline void add(int x, long long y) {
    while (x <= n) {
      c[x] += y;
      x += x & -x;
    }
  }
  inline long long query(int x) {
    long long s = 0;
    while (x) {
      s += c[x];
      x -= x & -x;
    }
    return s;
  }
} b[20];
int main() {
  n = read(), k = read();
  for (register int i = 1; i <= n; i++) a[i] = read();
  for (register int i = 1; i <= n; i++) {
    b[1].add(a[i], 1);
    for (register int j = 2; j <= k + 1; j++) {
      dp[i][j] = b[j - 1].query(a[i] - 1);
      b[j].add(a[i], dp[i][j]);
    }
  }
  for (register int i = 1; i <= n; i++) ans += dp[i][k + 1];
  printf("%lld", ans + (!k));
  return 0;
}
inline int read() {
  register int x = 0, f = 1;
  register char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 3) + (x << 1) + (c ^ 48);
    c = getchar();
  }
  return x * f;
}

```