#include <bits/stdc++.h>
using namespace std;
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a, i, cnt[11] = {0};
  for (i = 0; i < n; i++) {
    cin >> a;
    cnt[a]++;
  }
  long long ans = ((long long)n * (n + 1)) / 2;
  for (i = 0; i <= m; i++) {
    ans = ans - ((long long)cnt[i] * (1 + cnt[i])) / 2;
  }
  cout << ans << endl;
  return 0;
}
