#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000")
using namespace std;
int ri() {
  int x;
  scanf("%d", &x);
  return x;
}
int cnt[1000100];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  long long ans = (long long)n * (long long)(n - 1) * (long long)(n - 2) / 6LL;
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    cnt[a]++;
    cnt[b]++;
  }
  long long sub = 0;
  for (int i = 1; i <= n; i++) {
    if (cnt[i] != 0) {
      sub += (long long)cnt[i] * (n - 1 - (long long)cnt[i]);
    }
  }
  ans -= sub / 2LL;
  printf("%lld\n", ans);
  return 0;
}
