#include <bits/stdc++.h>
using namespace std;
int deg[10000005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m, x, y;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    deg[x]++;
    deg[y]++;
  }
  long long int ans, tmp = 0;
  ans = n;
  ans *= (n - 1);
  ans *= (n - 2);
  ans /= 6;
  for (int i = 1; i <= n; i++) {
    tmp += deg[i] * (n - 1 - deg[i]);
  }
  tmp /= 2;
  ans -= tmp;
  cout << ans;
}
