#include <bits/stdc++.h>
using namespace std;
int n, m, cnt[300000 + 10];
int main() {
  scanf("%d%d", &n, &m);
  memset(cnt, 0, sizeof cnt);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    cnt[x]++;
  }
  long long ret = 0;
  for (int i = 1; i <= m; i++)
    for (int j = i + 1; j <= m; j++) {
      ret += 1ll * cnt[i] * cnt[j];
    }
  cout << ret << endl;
  return 0;
}
