#include <bits/stdc++.h>
using namespace std;
int s[1000005];
int n, m;
int main() {
  int i, j, k, t1, t2, t3;
  long long l1, l2, l3;
  while (scanf("%d%d", &n, &m) != EOF) {
    memset(s, 0, sizeof(s));
    for (i = 0; i != m; ++i) {
      scanf("%d%d", &t1, &t2);
      ++s[t1];
      ++s[t2];
    }
    l1 = 0;
    for (i = 1; i != n + 1; ++i) {
      l1 += s[i] * (n - 1 - s[i]);
    }
    l1 /= 2;
    l2 = (long long)(n) * (n - 1) * (n - 2) / 6;
    printf("%I64d\n", l2 - l1);
  }
  return 0;
}
