#include <bits/stdc++.h>
int grau[(int)1e6 + 10];
int main() {
  int M;
  long long N;
  scanf("%I64d %d", &N, &M);
  long long cur = N * (N - 1LL) * (N - 2LL);
  cur /= 6LL;
  for (int i = 0; i < M; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    grau[a]++;
    grau[b]++;
  }
  long long sum = 0LL;
  for (int i = 1; i <= N; i++) {
    long long cret =
        (long long)grau[i] * ((long long)N - 1LL - (long long)grau[i]);
    sum += cret;
  }
  sum /= 2LL;
  printf("%I64d\n", cur - sum);
  return 0;
}
