#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e5 + 10, M = 10 + 10, MOD = 1e9 + 7, INF = 1e8,
                    INFTAR = 1e18 + 5;
const long double PI = acos(-1);
int n, k;
long long int seg[M][4 * N];
pair<int, int> a[N];
void Add(int cur, int id, long long int val, int b = 0, int e = n,
         int ind = 1) {
  if (b + 1 == e) {
    seg[cur][ind] += val;
    return;
  }
  int mid = (b + e) / 2;
  if (id < mid) {
    Add(cur, id, val, b, mid, ind * 2);
  } else {
    Add(cur, id, val, mid, e, ind * 2 + 1);
  }
  seg[cur][ind] = seg[cur][ind * 2] + seg[cur][ind * 2 + 1];
  return;
}
long long int Get(int cur, int l, int r, int b = 0, int e = n, int ind = 1) {
  if (l <= b && e <= r) {
    return seg[cur][ind];
  }
  long long int res = 0;
  int mid = (b + e) / 2;
  if (l < mid) {
    res += Get(cur, l, r, b, mid, ind * 2);
  }
  if (mid < r) {
    res += Get(cur, l, r, mid, e, ind * 2 + 1);
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    Add(1, a[i].second, 1);
    if (a[i].second == 0) continue;
    for (int len = k + 1; len >= 2; len--) {
      long long int xD = Get(len - 1, 0, a[i].second);
      Add(len, a[i].second, xD);
    }
  }
  cout << seg[k + 1][1] << '\n';
  return 0;
}
