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