#include <bits/stdc++.h>
using namespace std;
const int INF = 2034567891;
const long long int INF64 = 1234567890123456789ll;
int dx[] = {1, -1, 0, 0, 1, -1, -1, 1};
int dy[] = {0, 0, 1, -1, -1, -1, 1, 1};
long long int gcd(long long int a, long long int b) {
  return (b == 0 ? a : gcd(b, a % b));
}
long long int lcm(long long int a, long long int b) {
  return (a * (b / gcd(a, b)));
}
long long int power(long long int x, long long int y) {
  long long int ans = 1;
  while (y > 0) {
    if (y & 1) ans = (ans * x) % 1000000007;
    x = (x * x) % 1000000007;
    y /= 2;
  }
  return ans;
}
const int N = 10 + 1e5;
long long int BIT[12][N], a[N], n;
void update(int k, long long int BIT[], long long int v) {
  for (; k <= N; k += k & (-k)) BIT[k] += v;
}
long long int query(long long int BIT[], int x) {
  long long int sum = 0;
  for (; x; x -= x & (-x)) sum += BIT[x];
  return sum;
}
int main() {
  long long int k;
  cin >> n >> k;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    update(a[i], BIT[1], 1ll);
    for (long long int j = 1; j <= k; j++)
      update(a[i], BIT[j + 1], query(BIT[j], a[i] - 1));
  }
  cout << query(BIT[k + 1], n);
}
