#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, i, j, k, l, t, s = 0, a, temp[11] = {0}, cnt = 0;
  long long r1 = 1, r2 = 1, r, r3;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> a;
    temp[a]++;
  }
  for (i = 1; i <= m; i++) {
    for (j = i + 1; j <= m; j++) {
      s = s + (temp[i] * temp[j]);
    }
  }
  cout << s << endl;
  return 0;
}
