#include <bits/stdc++.h>
long long w[1000001];
int m, n, a, b;
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &a, &b);
    w[a]++;
    w[b]++;
  }
  long long res = 0;
  for (int i = 1; i <= n; i++) {
    long long a = w[i], b = n - 1 - a;
    res += a * (a - 1) + b * (b - 1) - a * b;
  }
  printf("%I64d\n", res / 6);
}
