#include <bits/stdc++.h>
using namespace std;
int n, m;
int d[1000005];
int main() {
  scanf("%d%d", &n, &m);
  int l, r;
  for (int i = 0; i < m; ++i) {
    scanf("%d%d", &l, &r);
    ++d[l];
    ++d[r];
  }
  long long ans = (long long)n * (n - 1) / 2 * (n - 2) / 3;
  long long temp = 0;
  for (int i = 1; i <= n; ++i) {
    temp += (long long)d[i] * (n - 1 - d[i]);
  }
  ans -= temp / 2;
  printf("%I64d\n", ans);
  return 0;
}
