#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
long long int a[25];
int main() {
  int n, m, i, j;
  long long int ans = 0;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> j, a[j]++;
  long long int sum = 0;
  for (i = 1; i <= m; i++) sum += a[i];
  for (i = 1; i <= m; i++) ans += a[i] * (sum - a[i]);
  cout << ans / 2 << endl;
  return 0;
}
