#include <bits/stdc++.h>
using namespace std;
long long a[100010];
long long c[100010][15];
long long n, k;
long long lowbit(long long i) { return i & (-i); }
void add(long long i, long long j, long long v) {
  while (i <= n) {
    c[i][j] += v;
    i += lowbit(i);
  }
}
long long getsum(long long i, long long j) {
  long long sum = 0;
  while (i) {
    sum += c[i][j];
    i -= lowbit(i);
  }
  return sum;
}
int main() {
  cin >> n >> k;
  ++k;
  for (long long i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  long long ans = 0, x;
  for (long long i = 1; i <= n; ++i) {
    add(a[i], 1, 1);
    for (long long j = 2; j <= k; ++j) {
      add(a[i], j, getsum(a[i] - 1, j - 1));
    }
  }
  cout << getsum(n, k) << endl;
  return 0;
}
