#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000000 + 10;
int cnt[maxn];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a, --b;
    cnt[a]++;
    cnt[b]++;
  }
  long long tot = 1LL * n * (n - 1) * (n - 2) / 6;
  long long bad = 0;
  for (int i = 0; i < n; ++i) {
    bad += 1LL * cnt[i] * (n - 1 - cnt[i]);
  }
  cout << tot - bad / 2 << endl;
  return 0;
}
