#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int a[maxn], n, m;
int cnt[maxn];
void solve() {
  long long tot = 1LL * n * (n - 1) / 2;
  long long jianqu = 0;
  for (int i = 1; i <= m; i++) {
    if (cnt[i] < 2) continue;
    jianqu += 1LL * cnt[i] * (cnt[i] - 1) / 2;
  }
  printf("%I64d\n", tot - jianqu);
}
int main() {
  while (scanf("%d %d", &n, &m) != EOF) {
    memset(cnt, 0, sizeof(cnt));
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      cnt[a[i]]++;
    }
    solve();
  }
  return 0;
}
