#include <bits/stdc++.h>
int main() {
  int m, n;
  std::cin >> n >> m;
  int a[10] = {};
  for (int i = 0; i < n; ++i) {
    int d;
    std::cin >> d;
    ++a[d - 1];
  }
  int sum = 0;
  for (int i = 0; i < m; ++i) {
    for (int j = i + 1; j < m; ++j) {
      sum += a[i] * a[j];
    }
  }
  std::cout << sum << std::endl;
}
