#include <bits/stdc++.h>
long long n, m, i, ans, a[1000005];
inline void read(long long &x) {
  short negative = 1;
  x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') negative = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  x *= negative;
}
inline void print(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) print(x / 10);
  putchar(x % 10 + '0');
}
signed main(void) {
  read(n), read(m);
  for (i = 1; i <= m; i++) {
    long long u, v;
    read(u), read(v);
    a[u]++, a[v]++;
  }
  for (i = 1; i <= n; i++) ans += a[i] * (n - a[i] - 1);
  print((n * (n - 1) * (n - 2)) / 6 - ans / 2);
  return 0;
}
