#include <bits/stdc++.h>
using namespace std;
long long n, sum, ans;
int m, a[20], x;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    x--;
    a[x]++;
  }
  for (int i = 0; i < m; i++) {
    if (a[i] != 0) {
      for (int j = i + 1; j < m; j++) {
        sum += a[i] * a[j];
      }
    }
  }
  printf("%ld\n", sum);
  return 0;
}
