#include <bits/stdc++.h>
using namespace std;
long long number[11];
int main() {
  long long n, m, taker;
  memset(number, 0, sizeof(number));
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> taker;
    number[taker]++;
  }
  long long sum = 0;
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j != i; j++) {
      sum += number[i] * number[j];
    }
  }
  cout << sum << endl;
  return 0;
}
