#include <bits/stdc++.h>
using namespace std;
long long n, K, max_k;
long long BIT[100005][12];
void update(long long val, long long idx, long long k) {
  while (idx <= n) {
    BIT[idx][k] += val;
    idx += idx & -idx;
  }
}
long long sum(long long idx, long long k) {
  if (k == 0) return 1;
  long long s = 0;
  while (idx >= 1) {
    s += BIT[idx][k];
    idx -= idx & -idx;
  }
  return s;
}
int32_t main() {
  cin >> n >> K;
  vector<long long> data(n + 1);
  max_k = (K + 1);
  for (long long i = 1; i <= n; i++) {
    cin >> data[i];
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= max_k; j++) {
      BIT[i][j] = 0;
    }
  }
  for (long long i = 1; i <= n; i++) {
    for (long long k = 1; k <= max_k; k++) {
      long long val = sum(data[i] - 1, k - 1);
      update(val, data[i], k);
    }
  }
  cout << sum(n, max_k) << endl;
  return 0;
}
