#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, c;
  cin >> n >> m;
  long long i, ara[m + 2], books = (n * (n - 1)) / 2;
  memset(ara, 0, sizeof(ara));
  for (i = 1; i <= n; i++) {
    cin >> c;
    ara[c]++;
  }
  for (i = 1; i <= m; i++) {
    long long x = ara[i];
    long long bi = (x * (x - 1)) / 2;
    books = books - bi;
  }
  cout << books << endl;
}
