#include <bits/stdc++.h>
long long d[1000000];
int main() {
  int n, m, i, x, y;
  long long sum;
  scanf("%d %d", &n, &m);
  for (i = 0; i < m; i++) {
    scanf("%d %d", &x, &y);
    d[x - 1]++;
    d[y - 1]++;
  }
  sum = 0;
  for (i = 0; i < n; i++) {
    sum += (n - 1 - d[i]) * d[i];
  }
  printf("%I64d\n",
         (long long)n * (long long)(n - 1) * (long long)(n - 2) / 6 - sum / 2);
  return 0;
}
