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