#include <bits/stdc++.h>
const int maxn = 134672;
int a[maxn];
long long Tree[maxn][16];
int n, k;
void update(int p, long long v, int k) {
  for (; p <= n + 1; p += p & -p) Tree[p][k] += v;
}
long long getsum(int p, int k) {
  long long ret = 0;
  for (; p; p -= p & -p) ret += Tree[p][k];
  return ret;
}
int main() {
  scanf("%d%d", &n, &k);
  update(1, 1, 0);
  for (int i = 1; i <= n; ++i) {
    int x;
    scanf("%d", &x);
    for (int j = 1; j <= k + 1; ++j) {
      long long sum = getsum(x, j - 1);
      update(x + 1, sum, j);
    }
  }
  printf("%I64d\n", getsum(n + 1, k + 1));
  return 0;
}
