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