#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, sum = 0, ans = 0, k;
  cin >> n >> k;
  map<int, int> mp;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    cin >> x;
    mp[x]++;
  }
  for (auto it : mp) {
    int d = it.second;
    v.push_back(d);
  }
  for (int i = 0; i < v.size(); i++) {
    sum = sum + v[i];
  }
  for (int i = 0; i < v.size() - 1; i++) {
    sum = sum - v[i];
    ans = ans + (v[i] * sum);
  }
  cout << ans << endl;
}
