#include <bits/stdc++.h>
using namespace std;
const int MAX_N = (int)1e6 + 20;
int deg[MAX_N];
long long n, m;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int v, u;
    cin >> v >> u;
    deg[--v]++;
    deg[--u]++;
  }
  unsigned long long Cn3 = n * (n - 1) * (n - 2) / 6, ans = 0;
  for (int i = 0; i < n; i++) ans += deg[i] * (n - 1 - deg[i]);
  ans = Cn3 - ans / 2;
  cout << ans << endl;
  return 0;
}
