#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, same = 0, arr[15] = {0}, x, temp;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> x;
    arr[x]++;
  }
  x = 1;
  for (int i = n; i > n - 2; i--) x *= i;
  x /= 2;
  for (int i = 1; i <= 10; i++) {
    temp = 1;
    if (arr[i] < 2) continue;
    for (int j = arr[i]; j > arr[i] - 2; j--) temp *= j;
    temp /= 2;
    x -= temp;
  }
  cout << x << endl;
  return 0;
}
