#include <bits/stdc++.h>
using namespace std;
int n, m;
int cun[101];
int ans;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    int ls;
    scanf("%d", &ls);
    cun[ls]++;
  }
  for (int i = 1; i <= m; i++) {
    for (int j = i + 1; j <= m; j++) {
      ans += cun[i] * cun[j];
    }
  }
  printf("%d\n", ans);
  return 0;
}
