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