#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, g;
  cin >> n >> g;
  vector<long long> v, ans;
  map<long long, long long> m;
  map<long long, long long>::iterator it;
  for (int i = 0; i < n; i++) {
    long long a;
    cin >> a;
    m[a]++;
  }
  for (it = m.begin(); it != m.end(); ++it) {
    v.push_back(it->second);
  }
  long long s1 = 0;
  for (int i = 0; i < v.size() - 1; i++) {
    long long s = 0;
    for (int j = i + 1; j < v.size(); j++) {
      s += v[j];
    }
    s1 += s * v[i];
  }
  cout << s1 << endl;
  return 0;
}
