#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
const int maxp = 1e7 + 5;
int n, m;
int A[maxn], B[maxn], ind[maxn];
long long ans;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; ++i)
    scanf("%d%d", &A[i], &B[i]), ++ind[A[i]], ++ind[B[i]];
  for (int i = 1; i <= n; ++i) {
    ans -= (long long)ind[i] * (n - 1 - ind[i]);
  }
  ans /= 2;
  ans += (long long)n * (n - 1) * (n - 2) / 6;
  printf("%I64d", ans);
  return 0;
}
