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