#include <bits/stdc++.h>
using namespace std;
unsigned long long n, a[200000], f[20][200000], res = 0, k;
void u1(unsigned long long t, unsigned long long u, unsigned long long v) {
  while (u <= n) {
    f[t][u] += v;
    u += u & (-u);
  }
}
unsigned long long get(unsigned long long t, unsigned long long u) {
  unsigned long long res = 0;
  while (u) {
    res += f[t][u];
    u -= u & (-u);
  }
  return res;
}
void update(unsigned long long tmp) {
  u1(0, tmp, 1);
  for (unsigned long long i = 1; i <= k; i++) {
    unsigned long long o = get(i - 1, tmp - 1);
    u1(i, tmp, o);
  }
}
int main() {
  cin >> n >> k;
  for (unsigned long long i = 1; i <= n; i++) cin >> a[i];
  for (unsigned long long i = 1; i <= n; i++) update(a[i]);
  res = get(k, n);
  cout << res;
}
