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