#include <bits/stdc++.h>
using namespace std;
signed long long int deg[1000000 + 5];
int main() {
  int a, b;
  signed long long int n, m, ans;
  cin >> n >> m;
  ans = n * m;
  for (int i = 1; i <= m; ++i) {
    scanf("%d", &a);
    scanf("%d", &b);
    deg[a]++;
    deg[b]++;
  }
  for (int i = 1; i <= n; ++i) {
    ans -= deg[i] * (deg[i] + 1) / 2;
  }
  ans = n * (n - 1) * (n - 2) / 6 - ans;
  cout << ans;
}
