#include <bits/stdc++.h>
using namespace std;
inline bool isEq(double a, double b) { return (abs(a - b) < 1e-9); }
inline double NegZero(double x) {
  if (isEq(x, -0.0))
    return +0.0;
  else
    return x;
}
long long nCr(long long n, long long r) {
  long long c = 1;
  for (int i = 1; i <= r; i++) {
    c *= n;
    c /= i;
    n--;
  }
  return c;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m, ara[15], rep = 0, g;
  cin >> n >> m;
  memset(ara, 0, sizeof(ara));
  for (int i = 0; i < n; i++) {
    cin >> g;
    ara[g]++;
  }
  long long C = nCr(n, 2);
  for (int i = 1; i <= m; i++) {
    if (ara[i] > 1) C -= nCr(ara[i], 2);
  }
  cout << C;
  return 0;
}
