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