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