#include <bits/stdc++.h>
using namespace std;
const int M = 2e5 + 5;
unsigned long long dp[M][12];
int A[M], n, K;
struct BIT {
  unsigned long long bit[M];
  inline void add(int x, unsigned long long a) {
    for (; x <= n; bit[x] += a, x += x & -x)
      ;
  }
  inline unsigned long long sum(int x) {
    unsigned long long ans = 0;
    for (; x; ans += bit[x], x -= x & -x)
      ;
    return ans;
  }
  inline void Init() { memset(bit, 0, sizeof(bit)); }
} T;
int main() {
  cin >> n >> K;
  ++K;
  for (int i = 1; i <= n; ++i) scanf("%d", &A[i]), dp[i][1] = 1;
  for (int i = 1; i <= n; ++i) T.add(A[i], 1);
  for (int i = 2; i <= K; ++i) {
    T.Init();
    for (int j = 1; j <= n; ++j) {
      T.add(A[j], dp[j][i - 1]);
      dp[j][i] += T.sum(A[j] - 1);
    }
  }
  unsigned long long ans = 0;
  for (int i = 1; i <= n; ++i) ans += dp[i][K];
  cout << ans << endl;
  return 0;
}
