#include <bits/stdc++.h>
using namespace std;
long long deg[1000100];
int main() {
  long long n, m, u, v, sum = 0;
  cin >> n >> m;
  long long ans = (n) * (n - 1) * (n - 2) / 6;
  while (m--) {
    scanf("%lld%lld", &u, &v);
    ++deg[u];
    ++deg[v];
  }
  for (int i = 1; i <= n; i++) sum += deg[i] * (n - 1 - deg[i]);
  cout << ans - sum / 2 << endl;
  return 0;
}
