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