#include <bits/stdc++.h>
int N, M, f[2000000], g[2000000], x, y;
long long ans;
int main() {
  scanf("%d%d", &N, &M);
  for (int i = 1; i <= N; ++i) f[i] = N - 1, g[i] = 0;
  for (int i = 0; i < M; ++i) {
    scanf("%d%d", &x, &y);
    --f[x], --f[y], ++g[x], ++g[y];
  }
  for (int i = 1; i <= N; ++i) ans += (long long)f[i] * (long long)g[i];
  printf("%I64d\n", (long long)N * (long long)(N - 2) * (long long)(N - 1) / 6 -
                        (ans >> 1));
  return 0;
}
