#include <bits/stdc++.h>
using namespace std;
int deg[1000001], n, m, x, y;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &x, &y);
    ++deg[x], ++deg[y];
  }
  long long dec = 0;
  for (int i = 1; i <= n; ++i) dec += (long long)deg[i] * (n - 1 - deg[i]);
  cout << ((long long)n * (n - 1) * (n - 2)) / 6 - dec / 2 << endl;
  return 0;
}
