#include <bits/stdc++.h>
using namespace std;
const int NN = 1000 * 1000 + 100;
int deg[NN];
int main() {
  ios::sync_with_stdio(false);
  long long n, m;
  cin >> n >> m;
  long long tot;
  tot = n * (n - 1) * (n - 2);
  tot /= 6;
  int a, b;
  memset(deg, 0, sizeof(deg));
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &a, &b);
    deg[a]++;
    deg[b]++;
  }
  long long cant = 0;
  for (int i = 1; i < n + 1; i++) {
    cant += ((long long)deg[i] * (long long)(n - 1 - deg[i]));
  }
  cant >>= 1;
  cout << tot - cant << endl;
}
