#include <bits/stdc++.h>
long long tree[12][200005] = {0}, arr[100005] = {0}, tmp;
int n, k, i, j;
long long fsum(int t, int idx) {
  long long ans = 0;
  while (idx > 0) {
    ans += tree[t][idx];
    idx -= (idx & -idx);
  }
  return ans;
}
void updat(int t, int idx, long long val) {
  while (idx <= n) {
    tree[t][idx] += val;
    idx += (idx & -idx);
  }
}
int main() {
  scanf("%d %d", &n, &k);
  for (i = 1; i <= n; i++) {
    scanf("%lld", &arr[i]);
    updat(1, arr[i], 1);
    for (j = 2; j <= k + 1; j++) {
      tmp = fsum(j - 1, arr[i] - 1);
      updat(j, arr[i], tmp);
    }
  }
  printf("%lld", fsum(k + 1, n));
  return 0;
}
