#include <bits/stdc++.h>
using namespace std;
int cnt[15], sum;
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    int t;
    cin >> t;
    cnt[t]++;
    sum++;
  }
  int ans = 0;
  for (int i = 1; i <= m; i++) {
    sum -= cnt[i];
    ans += cnt[i] * sum;
  }
  cout << ans << endl;
  return 0;
}
