#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
int n, k, a[N];
long long seg[4 * N + 4], dp[N + 1][12];
void update(int p, int l, int r, int indx, long long val) {
  if (l == r) {
    seg[p] = val;
    return;
  }
  int mid = l + (r - l) / 2;
  if (indx <= mid)
    update(p * 2, l, mid, indx, val);
  else
    update(p * 2 + 1, mid + 1, r, indx, val);
  seg[p] = seg[p * 2] + seg[p * 2 + 1];
}
long long get(int p, int l, int r, int a, int b) {
  if (l >= a && r <= b) {
    return seg[p];
  }
  if (l > b || r < a) {
    return 0;
  }
  int mid = l + (r - l) / 2;
  return get(p * 2, l, mid, a, b) + get(p * 2 + 1, mid + 1, r, a, b);
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; ++i) scanf("%d", a + i);
  for (int i = 0; i <= N; ++i) dp[i][1] = 1;
  for (int j = 2; j <= k + 1; ++j) {
    memset(seg, 0, sizeof seg);
    for (int i = 0; i < n; ++i) {
      dp[i][j] = get(1, 0, n - 1, 1, a[i] - 1);
      update(1, 0, n - 1, a[i], dp[i][j - 1]);
    }
  }
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    ans += dp[i][k + 1];
  }
  printf("%lld\n", ans);
}
