#include <bits/stdc++.h>
using namespace std;
int n, m;
int DR[1000001];
int DA[1000001];
int i, v1, v2;
long long tot;
long long suma, rez;
int main() {
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) DA[i] = n - 1;
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &v1, &v2);
    DR[v1]++;
    DR[v2]++;
    DA[v1]--;
    DA[v2]--;
  }
  suma = 0;
  for (i = 1; i <= n; i++) suma = suma + (long long)DR[i] * DA[i];
  suma = (suma >> 1);
  tot = (((long long)n) * (n - 1)) * (n - 2) / 6LL;
  rez = tot - suma;
  cout << rez;
  return 0;
}
