#include <bits/stdc++.h>
using namespace std;
int n, m, x, i = 1, j = 1, a[11];
long long sum;
map<int, int> mp;
map<int, int>::iterator it;
int main() {
  cin >> n >> m;
  while (n--) {
    cin >> x;
    mp[x]++;
  }
  it = mp.begin();
  while (it != mp.end()) {
    a[i] = it->second;
    i++, it++, j++;
  }
  for (i = 2; i < j; i++) a[i] += a[i - 1];
  it = mp.begin(), i = 1;
  while (it != mp.end()) {
    sum += (a[j - 1] - a[i]) * it->second;
    i++, it++;
  }
  cout << sum << endl;
  return 0;
}
