#include <bits/stdc++.h>
using namespace std;
int cnt[20];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < (n); i++) {
    int x;
    scanf("%d", &x);
    cnt[x]++;
  }
  long long ans = (long long)n * (n - 1) / 2;
  for (int i = 1; i <= (m); i++) ans -= (long long)cnt[i] * (cnt[i] - 1) / 2;
  cout << ans;
  return 0;
}
