#include <bits/stdc++.h>
using namespace std;
int n;
long long int aib[15][100005];
inline void update(long long int aib[], int pos, long long int val) {
  for (; pos <= n; pos += ((pos) & (-(pos)))) aib[pos] += val;
}
inline long long int query(long long int aib[], int pos) {
  long long int ans = 0;
  for (; pos; pos -= ((pos) & (-(pos)))) ans += aib[pos];
  return ans;
}
long long int dp[15][100005];
int main() {
  ios_base ::sync_with_stdio(false);
  int k;
  cin >> n >> k;
  ++k;
  long long int ans = 0;
  int val;
  for (int i = 1; i <= n; ++i) {
    cin >> val;
    dp[1][i] = val;
    update(aib[1], val, 1);
    for (int j = 2; j <= k; ++j) {
      dp[j][i] = query(aib[j - 1], val - 1);
      update(aib[j], val, dp[j][i]);
    }
    ans += dp[k][i];
  }
  cout << ans << '\n';
  return 0;
}
