#include <bits/stdc++.h>
int n, m;
int cnt[1000010];
int main() {
  int u, v;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &u, &v);
    cnt[u]++;
    cnt[v]++;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    long long pair = cnt[i] * 1LL * (cnt[i] - 1);
    pair -= 1LL * cnt[i] * (n - 1 - cnt[i]);
    pair += 1LL * (n - 1 - cnt[i]) * (n - 2 - cnt[i]);
    ans += pair;
  }
  printf("%I64d\n", ans / 6);
  return 0;
}
