#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAX = 0x7fffffff;
const long long LMAX = 0x7fffffffffffffff;
const double eps = 1e-9;
const double pi = acos(-1.0);
const int maxn = 100000 + 5;
const int maxm = 100000 + 5;
const int mod = 1000000000 + 7;
int n, k;
int a[maxn];
long long c[maxn][12];
int lowbit(int x) { return x & (-x); }
void add(int x, long long v, int ind) {
  while (x <= n) {
    c[x][ind] += v;
    x += lowbit(x);
  }
}
long long sum(int x, int ind) {
  long long sum = 0;
  while (x > 0) {
    sum += c[x][ind];
    x -= lowbit(x);
  }
  return sum;
}
long long dp[maxn][12];
void slove() {
  memset(dp, 0, sizeof dp);
  memset(c, 0, sizeof c);
  dp[1][1] = 1;
  add(a[1], 1, 1);
  for (int i = 2; i <= n; ++i) {
    dp[i][1] = 1;
    for (int j = 2; j <= k; ++j) {
      dp[i][j] += sum(a[i] - 1, j - 1);
    }
    for (int j = 1; j <= k; ++j) {
      if (dp[i][j]) {
        add(a[i], dp[i][j], j);
      }
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; ++i) ans += dp[i][k];
  cout << ans << endl;
}
int main() {
  while (cin >> n >> k) {
    k++;
    for (int i = 1; i <= n; ++i) cin >> a[i];
    slove();
  }
  return 0;
}
