#include <bits/stdc++.h>
using namespace std;
int cnt[1000010];
int main() {
  int n, m, a, b;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &a, &b);
    a--;
    b--;
    cnt[a]++;
    cnt[b]++;
  }
  if (n < 3) {
    puts("0");
    return 0;
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans += ((long long)cnt[i]) * ((long long)(n - 1 - cnt[i]));
  }
  ans = ((long long)n) * (n - 1) * (n - 2) / 6 - ans / 2;
  printf("%I64d\n", ans);
  return 0;
}
