#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  int deg[n + 1];
  memset(deg, 0, sizeof deg);
  for (int i = 0, u, v; i < m; ++i) {
    cin >> u >> v;
    ++deg[u];
    ++deg[v];
  }
  long long ans = 0;
  for (int i = 1; i <= n; ++i) ans += (long long)deg[i] * (n - 1 - deg[i]);
  ans /= 2;
  ans = (long long)n * (n - 1) * (n - 2) / 6 - ans;
  cout << ans << '\n';
  return 0;
}
