#include <bits/stdc++.h>
using namespace std;
const int N = 1e+5;
const int K = 10;
vector<vector<long long>> t(K + 2, vector<long long>(N + 2));
vector<int> a;
int n;
void up(int i, int j, long long v) {
  while (i <= n) {
    t[j][i] += v;
    i += (i & -i);
  }
}
long long query(int i, int j) {
  long long res = 0;
  while (i > 0) {
    res += t[j][i];
    i -= (i & -i);
  }
  return res;
}
int main() {
  int k;
  cin >> n >> k;
  a.assign(n, 0);
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    up(x, 1, 1);
    for (int j = 2; j <= k + 1; ++j) up(x, j, query(x - 1, j - 1));
  }
  cout << query(n, k + 1);
}
