#include <bits/stdc++.h>
using namespace std;
long long rdtsc() {
  long long tmp;
  asm("rdtsc" : "=A"(tmp));
  return tmp;
}
inline int myrand() { return abs((rand() << 15) ^ rand()); }
inline int rnd(int x) { return myrand() % x; }
const int INF = (int)1.01e9;
const long double EPS = 1e-9;
void precalc() {}
const int maxn = (int)1e5 + 10, maxk = 10 + 5;
int a[maxn];
int n, k;
bool read() {
  if (scanf("%d%d", &n, &k) < 2) {
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
  }
  return 1;
}
long long dp[maxn][maxk];
pair<int, int> tosort[maxn];
int where[maxn];
struct FenvTree {
  long long a[maxn];
  int n;
  void build(int _n) {
    n = _n;
    for (int i = 0; i < n; ++i) {
      a[i] = 0;
    }
  }
  long long get(int pos) {
    long long res = 0;
    for (int x = pos; x >= 0; x = (x & (x + 1)) - 1) {
      res += a[x];
    }
    return res;
  }
  void add(int pos, long long toadd) {
    for (int x = pos; x < n; x |= (x + 1)) {
      a[x] += toadd;
    }
  }
} tree[maxk];
void solve() {
  for (int i = 0; i < n; ++i) {
    tosort[i] = make_pair(a[i], i);
  }
  sort(tosort, tosort + n);
  for (int i = 0; i < n; ++i) {
    where[tosort[i].second] = i;
  }
  ++k;
  for (int i = 0; i < k; ++i) {
    tree[i].build(n);
  }
  long long res = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = k - 1; j >= 0; --j) {
      long long value = 0;
      if (!j) {
        value += 1;
      } else {
        value = tree[j - 1].get(where[i] - 1);
      }
      tree[j].add(where[i], value);
      if (j == k - 1) {
        res += value;
      }
    }
  }
  printf(
      "%lld"
      "\n",
      res);
}
int main() {
  srand(rdtsc());
  precalc();
  while (1) {
    if (!read()) {
      break;
    }
    solve();
  }
  return 0;
}
