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