#include <bits/stdc++.h>
using namespace std;
int getint() {
  char c;
  for (c = getchar(); c < '0' || c > '9'; c = getchar())
    ;
  int t = c - 48;
  for (c = getchar(); c >= '0' && c <= '9'; c = getchar()) t = t * 10 + c - 48;
  return t;
}
void putint(int n) {
  char a[9];
  int size = 0;
  if (n == 0) putchar('0');
  while (n) {
    a[size++] = n % 10 + 48;
    n /= 10;
  }
  for (int i = size - 1; i >= 0; i--) putchar(a[i]);
  putchar('\n');
}
int n, m, a[20], x, ans;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    a[x]++;
  }
  ans = 0;
  for (int i = 1; i < m; i++)
    for (int j = i + 1; j <= m; j++) ans += a[i] * a[j];
  cout << ans << endl;
}
