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