#include <bits/stdc++.h>
using namespace std;
long long a[2000666];
long long fr[2000666];
int main() {
  long long n, m, i, result = 0, sum = 0;
  cin >> n >> m;
  for (i = 1; i <= n; ++i) {
    cin >> a[i];
    ++fr[a[i]];
    sum++;
  }
  result = (sum * (sum - 1)) / (long long)2;
  for (i = 1; i <= 10; ++i) result -= (fr[i] * (fr[i] - 1)) / (long long)2;
  cout << result << '\n';
  return 0;
}
