#include <bits/stdc++.h>
using namespace std;
long N, M;
long arr[200005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> N >> M;
  for (int i = 1; i <= N; i++) {
    int x;
    cin >> x;
    arr[x] = arr[x] + 1;
  }
  int ans = 0;
  for (long i = 1; i <= M; i++) {
    for (long j = i + 1; j <= M; j++) {
      ans = ans + (arr[i] * arr[j]);
    }
  }
  cout << ans << endl;
  return 0;
}
