#include <bits/stdc++.h>
void upd(long long unsigned *B, unsigned n, long long unsigned v) {
  for (; n < 111111; n += n & -n) B[n] += v;
  return;
}
long long unsigned que(long long unsigned *B, unsigned n) {
  long long unsigned v = 0llu;
  for (; n; n &= n - 1) v += B[n];
  return v;
}
long long unsigned D[11][111111];
int main() {
  unsigned n, i, j, k;
  scanf("%u%u", &n, &k);
  while (n--) {
    scanf("%u", &i);
    for (j = 11; --j;) upd(D[j], i, que(D[j - 1], i));
    upd(D[0], i, 1);
  }
  printf("%I64u\n", que(D[k], 111110));
  return 0;
}
