#include <bits/stdc++.h>
using namespace std;
int cnt[1010000];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  while (m--) {
    int a, b;
    scanf("%d%d", &a, &b);
    cnt[a]++;
    cnt[b]++;
  }
  long long x = 0;
  for (int i = (1); i <= (n); i++) x += (n - 1LL - cnt[i]) * cnt[i];
  x /= 2;
  x = n * (n - 1LL) * (n - 2LL) / 6 - x;
  printf("%I64d\n", x);
}
