#include <bits/stdc++.h>
using namespace std;
long long n, k;
vector<vector<long long>> ft(12, vector<long long>(100005, 0));
void add(long long kk, long long ind, long long val) {
  while (ind <= n) {
    ft[kk][ind] += val;
    ind += ind & -ind;
  }
}
long long sum(long long kk, long long ind) {
  long long res = 0;
  while (ind > 0) {
    res += ft[kk][ind];
    ind -= ind & -ind;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  vector<long long> arr(n + 1);
  for (int i = 1; i < n + 1; i++) cin >> arr[i];
  for (int i = 1; i < n + 1; i++) {
    for (int j = 1; j < 12; j++) {
      if (j == 1)
        add(1, arr[i], 1);
      else {
        long long val = sum(j - 1, arr[i] - 1);
        add(j, arr[i], val);
      }
    }
  }
  cout << sum(k + 1, n);
  return 0;
}
