#include <bits/stdc++.h>
using namespace std;
long long n, m, a[20101010], ans = 0, b[12], r;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    b[a[i] - 1]++;
  }
  for (int i = 0; i < m; i++) {
    r = 0;
    for (int j = i + 1; j < m; j++) {
      r += b[j];
    }
    ans += b[i] * r;
  }
  cout << ans;
}
