#include <bits/stdc++.h>
using namespace std;
long long int deg[1000005];
int main() {
  long long int n, m;
  scanf("%lld%lld", &n, &m);
  for (long long int i = 0; i < m; i++) {
    long long int l, r;
    scanf("%lld%lld", &l, &r);
    deg[l]++;
    deg[r]++;
  }
  long long int res = 0;
  for (long long int i = 0; i < 1000005; i++) res += deg[i] * (n - deg[i] - 1);
  res /= 2;
  res = n * (n - 1) * (n - 2) / 6 - res;
  printf("%lld", res);
}
