#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
constexpr long long INF = 1LL << 60;
constexpr long double PI = 3.141592653589;
using namespace std;
template <typename T = long long>
using vec = vector<T>;
template <typename T = long long>
using vec2 = vector<vector<T>>;
template <typename T = long long>
using vec3 = vector<vector<vector<T>>>;
template <typename T>
inline bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
inline bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
namespace snow {
struct IoSetup {
  IoSetup() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(10);
  }
} iosetup;
}  // namespace snow
template <typename T1, typename T2>
std::ostream &operator<<(std::ostream &os, const std::pair<T1, T2> &p) {
  os << p.first << " " << p.second;
  return os;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &is, std::pair<T1, T2> &p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T1, typename T2, typename T3>
std::ostream &operator<<(std::ostream &os, const std::tuple<T1, T2, T3> &t) {
  auto &[a, b, c] = t;
  os << a << " " << b << " " << c;
  return os;
}
template <typename T1, typename T2, typename T3>
std::istream &operator>>(std::istream &is, std::tuple<T1, T2, T3> &t) {
  auto &[a, b, c] = t;
  is >> a >> b >> c;
  return is;
}
template <typename T>
std::ostream &operator<<(std::ostream &os, const std::vector<T> &v) {
  for (int i = 0; i < (int)v.size(); ++i) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}
template <typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &v) {
  for (T &in : v) is >> in;
  return is;
}
template <typename T>
std::ostream &operator<<(std::ostream &os, const std::set<T> &st) {
  int ct = 0;
  for (auto &s : st) os << s << (++ct != (int)st.size() ? " " : "");
  return os;
}
template <class... T>
void input(T &...a) {
  (std::cin >> ... >> a);
}
void print() { std::cout << '\n'; }
template <class T, class... Ts>
void print(const T &a, const Ts &...b) {
  std::cout << a;
  (std::cout << ... << (std::cout << ' ', b));
  std::cout << '\n';
}
int drop() {
  std::cout << '\n';
  exit(0);
}
template <class T, class... Ts>
int drop(const T &a, const Ts &...b) {
  std::cout << a;
  (std::cout << ... << (std::cout << ' ', b));
  std::cout << '\n';
  exit(0);
}
using namespace snow;
int main() {
  long long N, M;
  cin >> N >> M;
  vec<> A(N);
  cin >> A;
  map<int, int> mp;
  for (auto a : A) mp[a]++;
  long long ans = 0;
  for (long long i = 1; i <= (M); ++i)
    for (long long j = 1; j <= (M); ++j)
      if (i < j) {
        ans += mp[i] * mp[j];
      }
  print(ans);
  return 0;
}
