#include <bits/stdc++.h>
using namespace std;
class TheBestGift {
  int numBook;
  int numGenres;
  int numResult;
  map<int, int> miiGenresNum;

 public:
  void initial(int, int);
  void input();
  void compute();
  void output();
};
void TheBestGift::initial(int g, int b) {
  numGenres = g, numBook = b, numResult = 0;
  miiGenresNum.clear();
}
void TheBestGift::input() {
  int t;
  for (int i = 0; i < numBook; i++) {
    cin >> t;
    miiGenresNum[t]++;
  }
}
void TheBestGift::compute() {
  for (int i = 1; i <= numGenres; i++) {
    for (int j = i + 1; j <= numGenres; j++) {
      numResult += miiGenresNum[i] * miiGenresNum[j];
    }
  }
}
void TheBestGift::output() { cout << numResult << endl; }
int main() {
  int n, m;
  TheBestGift tbg;
  while (cin >> n) {
    cin >> m;
    tbg.initial(m, n);
    tbg.input();
    tbg.compute();
    tbg.output();
  }
  return 0;
}
