#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const int N = 400005;
const int MOD = 1000000007;
const int M = 1000005;
long long a[10005];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    x--;
    a[x]++;
  }
  long long ans = 0;
  for (int i = 0; i < m; ++i)
    for (int j = i + 1; j < m; ++j) {
      ans += a[i] * a[j];
    }
  cout << ans << endl;
  return 0;
}
