#include <bits/stdc++.h>
using namespace std;
const int N = 1e6;
long long d[N + 10], ans, n, m, sum;
int main() {
  int x, y;
  scanf("%I64d%I64d", &n, &m);
  sum = n * (n - 1) / 2 * (n - 2) / 3;
  while (m--) {
    scanf("%d%d", &x, &y);
    d[x]++;
    d[y]++;
  }
  for (int i = 1; i <= n; i++) ans = ans + (d[i] * (n - 1 - d[i]));
  ans /= 2;
  printf("%I64d\n", sum - ans);
  return 0;
}
