#include <bits/stdc++.h>
template <typename A, typename B>
inline void umin(A &x, B y) {
  if (x > y) x = y;
}
template <typename A, typename B>
inline void umax(A &x, B y) {
  if (x < y) x = y;
}
const int MAXN = 200005;
using namespace std;
int cnt[15];
int n, m, a, ans;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a);
    cnt[a]++;
  }
  for (int i = 1; i <= m; i++)
    for (int h = i + 1; h <= m; h++) ans += cnt[i] * cnt[h];
  printf("%d", ans);
}
