#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 100;
int d[MAXN];
int main() {
  long long n, m;
  scanf("%I64d%I64d", &n, &m);
  int x, y;
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &x, &y);
    d[--x]++, d[--y]++;
  }
  long long ans = n * (n - 1) * (n - 2) / 6, a = 0;
  for (int i = 0; i < n; i++) a += d[i] * (n - 1 - d[i]);
  a /= 2;
  ans -= a;
  printf("%I64d", ans);
  return 0;
}
