#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:66777216")
using namespace std;
int a, b, c, d, i, j, n, m, k;
int deg[1000002];
int main() {
  scanf("%d%d", &n, &m);
  for (int _n((m)-1), i(0); i <= _n; i++) {
    scanf("%d%d", &a, &b);
    --a;
    --b;
    ++deg[a];
    ++deg[b];
  }
  long long ans = (long long)n * (n - 1) * (n - 2) / 6;
  long long sum = 0;
  for (int _n((n)-1), i(0); i <= _n; i++) {
    int s = deg[i], ns = n - 1 - deg[i];
    sum += (long long)s * ns;
  }
  ans -= sum / 2;
  cout << ans << endl;
}
