#include <bits/stdc++.h>
int a[200200];
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    ++a[x];
  }
  int s = 0;
  for (int i = 1; i <= m; ++i)
    for (int j = i + 1; j <= m; ++j) s += a[i] * a[j];
  printf("%d\n", s);
  return 0;
}
