#include <bits/stdc++.h>
using namespace std;
long long b[11][100005];
void update(int pos, int treeno, long long val) {
  while (pos <= 100001) {
    b[treeno][pos] += val;
    pos += (pos & (-pos));
  }
}
long long query(int pos, int treeno) {
  long long sum = 0;
  for (int i = pos; i > 0; i -= (i & (-i))) sum += b[treeno][i];
  return sum;
}
void print() {
  for (int i = 0; i < 5; i++)
    for (int j = 0; j < 10; j++) cout << b[i][j] << " \n"[j == 9];
}
int main() {
  int n, k;
  scanf("%d", &n);
  scanf("%d", &k);
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    for (int i = k; i > 0; i--) {
      update(x, i, query(x, i - 1));
    }
    update(x, 0, 1);
  }
  cout << query(n, k) << endl;
  return 0;
}
