#include <bits/stdc++.h>
using namespace std;
int arr[200010];
int main() {
  long long int test, m, c = 0, sum = 0, sum1 = 0, i, j;
  cin >> test >> m;
  for (int i = 1; i <= test; i++) {
    int a;
    cin >> a;
    arr[a] = arr[a] + 1;
  }
  for (i = 1; i <= m; i++) {
    for (j = i + 1; j <= m; j++) {
      sum = sum + arr[i] * arr[j];
    }
  }
  cout << sum << endl;
  return 0;
}
