#include <bits/stdc++.h>
using namespace std;
long long DP[15][100010];
long long BIT[15][100010];
long long tab[100010];
long long n, k;
void update(long long x, long long y, long long val) {
  for (long long i = y; i <= n; i += (i & -i)) BIT[x][i] += val;
}
long long query(long long x, long long y) {
  long long ans = 0;
  for (long long i = y; i; i -= (i & -i)) {
    ans += BIT[x][i];
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) cin >> tab[i];
  for (long long i = 1; i <= n; i++) DP[1][i] = 1;
  for (long long i = 2; i <= k + 1; i++) {
    for (long long j = 1; j <= n; j++) {
      DP[i][j] = query(i - 1, tab[j] - 1);
      update(i - 1, tab[j], DP[i - 1][j]);
    }
  }
  for (long long i = 1; i <= n; i++) update(k + 1, i, DP[k + 1][i]);
  cout << query(k + 1, n) << "\n";
}
