#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5 + 5, maxK = 15;
int n, k;
unsigned long long tree[maxN][maxK];
unsigned long long query(int index, int length) {
  unsigned long long ans = 0;
  while (index > 0) {
    ans += tree[index][length];
    index -= index & (-index);
  }
  return ans;
}
void update(int index, int length, unsigned long long val) {
  while (index <= n) {
    tree[index][length] += val;
    index += index & (-index);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  unsigned long long data[n];
  set<unsigned long long> s;
  for (int x = 0; x < n; x++) {
    cin >> data[x];
    s.insert(data[x]);
  }
  int index = 1;
  unordered_map<unsigned long long, int> mp;
  set<unsigned long long>::iterator it;
  for (it = s.begin(); it != s.end(); it++) {
    mp[*it] = index++;
  }
  for (int x = 0; x < n; x++) {
    data[x] = mp[data[x]];
  }
  for (int x = 0; x < n; x++) {
    update(data[x], 1, 1);
    for (int y = 2; y <= k + 1; y++) {
      update(data[x], y, query(data[x] - 1, y - 1));
    }
  }
  cout << query(n, k + 1) << "\n";
  return 0;
}

### Prompt

In CPP, your task is to solve 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 int maxN = 1e5 + 5, maxK = 15;
int n, k;
unsigned long long tree[maxN][maxK];
unsigned long long query(int index, int length) {
  unsigned long long ans = 0;
  while (index > 0) {
    ans += tree[index][length];
    index -= index & (-index);
  }
  return ans;
}
void update(int index, int length, unsigned long long val) {
  while (index <= n) {
    tree[index][length] += val;
    index += index & (-index);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  unsigned long long data[n];
  set<unsigned long long> s;
  for (int x = 0; x < n; x++) {
    cin >> data[x];
    s.insert(data[x]);
  }
  int index = 1;
  unordered_map<unsigned long long, int> mp;
  set<unsigned long long>::iterator it;
  for (it = s.begin(); it != s.end(); it++) {
    mp[*it] = index++;
  }
  for (int x = 0; x < n; x++) {
    data[x] = mp[data[x]];
  }
  for (int x = 0; x < n; x++) {
    update(data[x], 1, 1);
    for (int y = 2; y <= k + 1; y++) {
      update(data[x], y, query(data[x] - 1, y - 1));
    }
  }
  cout << query(n, k + 1) << "\n";
  return 0;
}

```