#include <bits/stdc++.h>
using namespace std;
long long n, a1, p[200005], a[200005];
void update(int a) {
  for (int i = a; i <= n; i += (i & -i)) {
    p[i] += a1;
  }
}
long long solve(int a) {
  long long ans = 0;
  for (int i = a; i > 0; i -= (i & -i)) {
    ans += p[i];
  }
  return ans;
}
long long d[200005], k, ans;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> k;
  if (k == 0) {
    cout << n << endl;
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    cin >> d[i];
  }
  for (int i = 1; i <= n; i++) {
    a[i] = 1;
  }
  for (int i = 1; i <= k; i++) {
    for (int j = 1; j <= n; j++) {
      p[j] = 0;
    }
    for (int j = 1; j <= n; j++) {
      a1 = a[j];
      a[j] = solve(d[j]);
      update(d[j]);
    }
  }
  for (int i = 1; i <= n; i++) {
    ans += a[i];
  }
  cout << ans;
}
