#include <bits/stdc++.h>
const unsigned long long inf = 1LL << 61;
const double eps = 1e-5;
using namespace std;
bool cmp(int a, int b) { return a > b; }
long long a[200000 + 10];
int main() {
  long long n, m;
  while (cin >> n >> m) {
    map<int, int> mp;
    int b[20];
    memset(b, 0, sizeof(b));
    int num = 0;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      if (!mp[a[i]]) {
        mp[a[i]] = 1;
      } else {
        b[a[i]]++;
      }
    }
    long long sum = 0;
    for (int i = 1; i <= m; i++) {
      int x = b[i];
      sum += 1ll * x * (x + 1) / 2;
    }
    long long x = n * (n - 1);
    printf("%I64d\n", (x / 2 - sum));
  }
  return 0;
}
