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