#include <bits/stdc++.h>
using namespace std;
using ll = unsigned long long;
const int mn = 1e5 + 1;
ll n, k, f[mn][12], tree[mn * 4], ans = 0, a[mn];
void update(int l, int r, int x, int id, ll val) {
  if (!(l <= x && x <= r)) return;
  if (l == r) {
    tree[id] = val;
    return;
  }
  int mid = (l + r) / 2;
  update(l, mid, x, id * 2, val);
  update(mid + 1, r, x, id * 2 + 1, val);
  tree[id] = tree[id * 2] + tree[id * 2 + 1];
}
ll get(int l, int r, int x, int y, int id) {
  if (l > y || r < x) return 0;
  if (x <= l && r <= y) return tree[id];
  int mid = (l + r) / 2;
  return get(l, mid, x, y, id * 2) + get(mid + 1, r, x, y, id * 2 + 1);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  k += 1;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  if (k == 1) {
    cout << n << endl;
    return 0;
  }
  for (int i = 1; i <= k; ++i) {
    for (int j = 1; j <= n; ++j) {
      if (i == 1)
        f[j][i] = 1;
      else
        f[j][i] = get(1, n, 1, a[j] - 1, 1);
      update(1, n, a[j], 1, f[j][i - 1]);
      if (i == k) ans += get(1, n, 1, a[j] - 1, 1);
    }
    for (int j = 1; j <= n; ++j) {
      update(1, n, a[j], 1, 0);
    }
  }
  cout << ans << endl;
  return 0;
}
