#include <bits/stdc++.h>
using namespace std;
inline int in() {
  int res = 0;
  char c;
  while ((c = getchar()) < '0' || c > '9')
    ;
  while (c >= '0' && c <= '9') res = res * 10 + c - '0', c = getchar();
  return res;
}
const int N = 100100;
unsigned long long bit[12][N];
int a[N];
unsigned long long dp[12][N];
int n, k;
unsigned long long sum(int i, int k) {
  unsigned long long ret = 0;
  while (i > 0) {
    ret += bit[k][i];
    i -= i & -i;
  }
  return ret;
}
void add(int i, unsigned long long x, int k) {
  while (i <= n) {
    bit[k][i] += x;
    i += i & -i;
  }
}
int main() {
  n = in(), k = in() + 1;
  for (int i = 0; i < n; i++) {
    a[i] = in();
    dp[1][i + 1] = 1;
  }
  unsigned long long ans = 0;
  for (int i = 2; i <= k; i++) {
    for (int j = 0; j < n; j++) {
      dp[i][j + 1] = sum(a[j] - 1, i - 1);
      add(a[j], dp[i - 1][j + 1], i - 1);
    }
  }
  for (int i = 1; i <= n; i++) {
    ans += dp[k][i];
  }
  cout << ans << endl;
  return 0;
}
