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