#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
template <typename T>
void uin(T &a, T b) {
  if (b < a) {
    a = b;
  }
}
template <typename T>
void uax(T &a, T b) {
  if (b > a) {
    a = b;
  }
}
const long long N = 1000 * 1000 + 228;
long long deg[N];
signed main() {
  long long n, m;
  scanf("%lld %lld", &n, &m);
  long long u = 0, v = 0;
  for (long long i = 0; i < m; ++i) {
    scanf("%lld %lld", &u, &v);
    ++deg[u];
    ++deg[v];
  }
  long long bad = 0;
  for (long long i = 1; i <= n; ++i) {
    bad += deg[i] * (n - deg[i] - 1);
  }
  bad /= 2;
  long long res = n * (n - 1) * (n - 2) / 6 - bad;
  printf("%lld\n", res);
  return 0;
}
