#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, a, ans, count = 0, i, m, h[30] = {0};
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> a;
    h[a]++;
  }
  for (i = 0; i <= m; i++) {
    count += h[i] * (h[i] - 1) / 2;
  }
  ans = n * (n - 1) / 2 - count;
  cout << ans;
  return 0;
}
