#include <bits/stdc++.h>
using namespace std;
const unsigned _mod = 998244353;
const unsigned mod = 1e9 + 7;
const long long infi = 0x3f3f3f3f3f3f3f3fll;
const int inf = 0x3f3f3f3f;
long long ksm(long long x, long long y) {
  long long ret = 1;
  while (y) {
    if (y & 1ll) ret = ret * x % mod;
    y >>= 1ll;
    x = x * x % mod;
  }
  return ret;
}
long long qpow(long long x, long long y, long long m) {
  long long ret = 1;
  while (y) {
    if (y & 1ll) ret = ret * x % m;
    y >>= 1ll;
    x = x * x % m;
  }
  return ret;
}
inline long long _gcd(long long x, long long y) {
  return y ? _gcd(y, x % y) : x;
}
long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long n, k, c[200010][12], ans, x;
inline void Add(long long x, long long y, long long k) {
  long long p = x;
  while (p <= n) c[p][k] += y, p += p & -p;
}
inline long long Ans(long long x, long long k) {
  long long res = 0, p = x;
  while (p) res += c[p][k], p -= p & -p;
  return res;
}
int main() {
  cin >> n >> k;
  for (register int i = 1; i <= n; ++i) {
    scanf("%lld", &x);
    Add(x, 1, 1);
    for (register int j = 2; j <= k + 1; ++j) {
      long long s = Ans(x - 1, j - 1);
      Add(x, s, j);
      if (j == k + 1) ans += s;
    }
    if (k == 0) ans++;
  }
  cout << ans << '\n';
  return 0;
}

### Prompt

Please formulate 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;
const unsigned _mod = 998244353;
const unsigned mod = 1e9 + 7;
const long long infi = 0x3f3f3f3f3f3f3f3fll;
const int inf = 0x3f3f3f3f;
long long ksm(long long x, long long y) {
  long long ret = 1;
  while (y) {
    if (y & 1ll) ret = ret * x % mod;
    y >>= 1ll;
    x = x * x % mod;
  }
  return ret;
}
long long qpow(long long x, long long y, long long m) {
  long long ret = 1;
  while (y) {
    if (y & 1ll) ret = ret * x % m;
    y >>= 1ll;
    x = x * x % m;
  }
  return ret;
}
inline long long _gcd(long long x, long long y) {
  return y ? _gcd(y, x % y) : x;
}
long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long n, k, c[200010][12], ans, x;
inline void Add(long long x, long long y, long long k) {
  long long p = x;
  while (p <= n) c[p][k] += y, p += p & -p;
}
inline long long Ans(long long x, long long k) {
  long long res = 0, p = x;
  while (p) res += c[p][k], p -= p & -p;
  return res;
}
int main() {
  cin >> n >> k;
  for (register int i = 1; i <= n; ++i) {
    scanf("%lld", &x);
    Add(x, 1, 1);
    for (register int j = 2; j <= k + 1; ++j) {
      long long s = Ans(x - 1, j - 1);
      Add(x, s, j);
      if (j == k + 1) ans += s;
    }
    if (k == 0) ans++;
  }
  cout << ans << '\n';
  return 0;
}

```