#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n, m, a[N], ct = 0;
bool Read() {
  cin >> n;
  if (cin.eof()) return 0;
  cin >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  return 1;
}
void Process() {
  long long ans = (long long)n * ((long long)n - 1) / 2;
  int freq[11];
  memset(freq, 0, sizeof freq);
  for (int i = 0; i < n; i++) freq[a[i]]++;
  for (int i = 1; i <= m; i++)
    ans -= (long long)freq[i] * ((long long)freq[i] - 1) / 2;
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  while (Read()) Process();
  return 0;
}
