#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, s, d1, d = 0;
  long long m, num;
  cin >> n >> m;
  long long a[m];
  for (long long i = 0; i < m; i++) a[i] = 0;
  for (long long i = 0; i < n; i++) {
    cin >> num;
    a[num - 1]++;
  }
  s = n * (n - 1) / 2;
  for (long long i = 0; i < m; i++) {
    if (a[i] > 1) {
      d1 = a[i] * (a[i] - 1) / 2;
      d += d1;
    }
  }
  s -= d;
  cout << s << endl;
  return 0;
}
