#include <bits/stdc++.h>
using namespace std;
int n, k, x[100005], i;
unsigned long long y[11][18][100005], ta;
void f1(int a) {
  for (int b = 0; b < 18; b++) {
    y[i][b][a] += ta;
    a >>= 1;
  }
}
unsigned long long f2(int a, int b, int c, int d) {
  if (((1 << (c)) * (d)) == a && ((1 << (c)) * (d + 1)) == b) return y[i][c][d];
  c--;
  d = d * 2 + 1;
  unsigned long long re = 0;
  if (a < ((1 << (c)) * (d))) re += f2(a, min(b, ((1 << (c)) * (d))), c, d - 1);
  if (b > ((1 << (c)) * (d))) re += f2(max(a, ((1 << (c)) * (d))), b, c, d);
  return re;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int a = 0; a < n; a++) {
    scanf("%d", &x[a]);
    x[a]--;
  }
  for (int a = 0; a < n; a++)
    for (i = 0; i <= k; i++) {
      if (i) {
        i--;
        ta = x[a] ? f2(0, x[a], 17, 0) : 0;
        i++;
      } else
        ta = 1;
      f1(x[a]);
    }
  printf("%I64u\n", y[k][17][0]);
  return 0;
}
