#include <bits/stdc++.h>
using namespace std;
long long bit[12][100002];
void update(long long i, long long x, long long t) {
  while (i < 100002) {
    bit[t][i] += x;
    i = i + (i & (-i));
  }
}
long long sum(long long i, long long t) {
  long long sum = 0;
  while (i) {
    sum += bit[t][i];
    i = i - (i & (-i));
  }
  return sum;
}
void compress(vector<long long>& arr, long long n) {
  vector<pair<long long, long long>> temp;
  for (long long i = 0; i < n; i++) temp.push_back({arr[i], i});
  sort(temp.begin(), temp.end());
  long long k = 1;
  for (auto& p : temp) arr[p.second] = k++;
  return;
}
long long inv(vector<long long>& arr, long long k) {
  long long n = arr.size();
  compress(arr, n);
  for (long long i = n - 1; i >= 0; i--) {
    long long x = arr[i];
    update(x, 1, 1);
    for (long long j = 2; j <= k; j++) {
      long long toAdd = sum(x - 1, j - 1);
      update(x, toAdd, j);
    }
  }
  return sum(n, k);
}
int main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> arr;
  for (long long i = 0; i < n; i++) {
    long long a;
    cin >> a;
    arr.push_back(a);
  }
  if (k + 1 > n) {
    cout << 0 << endl;
    return 0;
  }
  reverse(arr.begin(), arr.end());
  cout << inv(arr, k + 1) << endl;
}
