#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d, e, fen[100009][12], f[100009], dp[100009][12];
long long read(long long q, long long w) {
  long long jm = 0;
  while (q >= 1) {
    jm += fen[q][w];
    q = q - (q & (-q));
  }
  return jm;
}
void upd(long long q, long long w, long long r) {
  while (q <= a) {
    fen[q][r] += w;
    q = q + (q & (-q));
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> a >> b;
  b++;
  for (c = 1; c <= a; c++) cin >> f[c];
  for (c = 1; c <= a; c++) {
    dp[c][1] = 1;
    for (d = 2; d <= b; d++) {
      dp[c][d] = read(f[c], d - 1);
    }
    for (d = 1; d <= b; d++) {
      upd(f[c], dp[c][d], d);
    }
  }
  e = 0;
  for (c = 1; c <= a; c++) {
    e += dp[c][b];
  }
  cout << e;
  return 0;
}
