#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n, m;
int cnt[11];
int main() {
  std ::ios_base ::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    int val;
    cin >> val;
    cnt[val]++;
  }
  long long res = 0;
  for (int i = 1; i <= m; i++) res += 1ll * cnt[i] * (n - cnt[i]);
  res /= 2;
  cout << res << "\n";
}
