#include <bits/stdc++.h>
using namespace std;
long long int bit[12][100009];
long long int n;
long long int sum(long long int i, long long int l) {
  long long int r = 0;
  while (l >= 0) {
    r += bit[i][l];
    l = (l & (l + 1)) - 1;
  }
  return r;
}
long long int sum(long long int i, long long int l, long long int r) {
  if (l > r) return 0;
  return sum(i, r) - sum(i, l - 1);
}
void inc(long long int i, long long int p, long long int del) {
  while (p <= n) {
    bit[i][p] += del;
    p = p | (p + 1);
  }
}
int main() {
  memset(bit, 0, sizeof(long long int) * 100009 * 12);
  long long int k;
  cin >> n >> k;
  long long int a[100009];
  for (long long int i = 0; i < n; i++) cin >> a[i];
  inc(1, a[n - 1], 1);
  for (long long int i = n - 2; i >= 0; i--) {
    inc(1, a[i], 1);
    for (long long int j = 2; j <= 11; j++) {
      long long int te = sum(j - 1, a[i] + 1, n);
      inc(j, a[i], te);
    }
  }
  cout << sum(k + 1, 1, n);
}
