#include <bits/stdc++.h>
using namespace std;
const int max_n = 1000010;
long long deg[max_n] = {0};
long long n, m;
long long tot, cmp, res;
int main() {
  cin >> n >> m;
  int u, v;
  for (long long i = 0; i < m; ++i) {
    scanf("%d%d", &u, &v);
    --u;
    --v;
    ++deg[u];
    ++deg[v];
  }
  tot = n * (n - 1) * (n - 2) / 6;
  cmp = 0;
  for (int i = 0; i < n; ++i) cmp += deg[i] * (n - 1 - deg[i]);
  cmp /= 2;
  res = tot - cmp;
  cout << res << endl;
}
