#include <bits/stdc++.h>
using namespace std;
int main() {
  long long freq[500005] = {0};
  long long n, m, ans = 0;
  scanf("%lld %lld", &n, &m);
  long long a[n + 1];
  for (long long i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
    freq[a[i]]++;
  }
  ans = n * (n - 1) / 2;
  for (long long i = 0; i < 500005; i++) {
    if (freq[i] > 1) ans -= freq[i] * (freq[i] - 1) / 2;
  }
  cout << ans;
}
