#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 20;
long long int c[15][maxn];
int lowbit(int x) { return x & (-x); }
void upDate(int pos, long long int val, int which) {
  while (pos <= maxn - 20) {
    c[which][pos] += val;
    pos += lowbit(pos);
  }
}
long long int ask(int pos, int which) {
  long long int ans = 0;
  while (pos) {
    ans += c[which][pos];
    pos -= lowbit(pos);
  }
  return ans;
}
long long int dp[maxn][15];
void work() {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    int x;
    cin >> x;
    dp[i][1] = 1;
    for (int j = 2; j <= k + 1; ++j) {
      dp[i][j] += ask(x - 1, j - 1);
    }
    for (int j = 1; j <= k + 1; ++j) {
      upDate(x, dp[i][j], j);
    }
  }
  long long int ans = 0;
  for (int i = 1; i <= n; ++i) ans += dp[i][k + 1];
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(false);
  work();
  return 0;
}
