#include <bits/stdc++.h>
using namespace std;
long long tree[12][100010];
long long read(int fg, long long idx) {
  long long sum = 0;
  while (idx > 0) {
    sum += tree[fg][idx];
    idx -= (idx & -idx);
  }
  return sum;
}
void update(int fg, int idx, long long val) {
  while (idx <= 100009) {
    tree[fg][idx] += val;
    idx += (idx & -idx);
  }
}
int main() {
  int n, k, f = 0;
  cin >> n >> k;
  long long arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int j = 0; j < n; j++) {
    for (int i = 1; i <= k + 1; i++) {
      if (i == 1)
        update(1, arr[j], 1);
      else
        update(i, arr[j], read(i - 1, arr[j] - 1));
    }
  }
  cout << read(k + 1, 100009);
  return 0;
}
