#include <bits/stdc++.h>
using namespace std;
int n, m, t, a[1000010], y[10010];
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    y[a[i]]++;
  }
  for (int i = 1; i <= m; i++) {
    for (int j = i + 1; j <= m; j++) {
      t = t + y[i] * y[j];
    }
  }
  cout << t << endl;
}
