#include <bits/stdc++.h>
using namespace std;
vector<int> happy_numbers;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> books;
  books.resize(m, 0);
  for (int i = 0; i < n; ++i) {
    int tmp;
    cin >> tmp;
    books[tmp - 1]++;
  }
  int ans = 0;
  set<pair<int, int>> been;
  for (int i = 0; i < m; ++i)
    for (int j = 0; j < m; ++j) {
      if (i == j) continue;
      pair<int, int> be(i, j), bee(j, i);
      if (been.count(be) || been.count(bee)) continue;
      been.insert(be);
      ans += books[i] * books[j];
    }
  cout << ans;
  return 0;
}
