#include <bits/stdc++.h>
using namespace std;
const double PI = (double)3.141592653589793238462643383279502884L;
const long long MOD = 1000000007;
void ioFromFile(string inputFileName = "input.txt",
                string outputFileName = "output.txt") {
  ifstream* fin = new ifstream(inputFileName);
  ofstream* fout = new ofstream(outputFileName);
  cin.rdbuf(fin->rdbuf());
  cout.rdbuf(fout->rdbuf());
}
int read() {
  int x;
  scanf("%d", &x);
  return x;
}
void write(int x) { printf("%d ", x); }
int n, k;
vector<int> in;
vector<long long> d;
vector<pair<int, long long> > merge(vector<pair<int, long long> > a) {
  int n = a.size();
  if (n == 1) return a;
  auto mid = a.begin() + n / 2;
  vector<pair<int, long long> > l =
      merge(vector<pair<int, long long> >{a.begin(), mid});
  vector<pair<int, long long> > r =
      merge(vector<pair<int, long long> >{mid, a.end()});
  int nl = l.size();
  int nr = r.size();
  vector<pair<int, long long> > res;
  res.reserve(n);
  long long c = 0;
  int i = 0;
  int j = 0;
  while (i < nl && j < nr) {
    if (l[i].first < r[j].first) {
      c += d[l[i].first];
      res.push_back(l[i++]);
    } else {
      r[j].second += c;
      res.push_back(r[j++]);
    }
  }
  while (i < nl) {
    res.push_back(l[i++]);
  }
  while (j < nr) {
    r[j].second += c;
    res.push_back(r[j++]);
  }
  return res;
}
long long solve() {
  for (int i = 0; i < k; i++) {
    vector<pair<int, long long> > toConquer;
    for (int i = 0; i < n; i++)
      toConquer.push_back(pair<int, long long>(in[i], 0));
    vector<pair<int, long long> > conqured = merge(toConquer);
    for (int j = 0; j < n; j++) {
      d[j] = conqured[j].second;
    }
  }
  long long res = 0;
  for (long long x : d) res += x;
  return res;
}
int main() {
  n = read();
  k = read();
  in.resize(n);
  for (int i = 0; i < n; i++) {
    in[i] = read() - 1;
  }
  d.resize(n, 1);
  cout << solve();
  return 0;
}
