#include <bits/stdc++.h>
int d[1000010];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  while (m--) {
    int x, y;
    scanf("%d%d", &x, &y);
    d[x]++;
    d[y]++;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += (d[i] * (n - 1LL - d[i]));
  }
  printf("%lld\n", (long long)(n * (n - 1LL) * (n - 2LL) / 6) - ans / 2);
  return 0;
}
