#include <bits/stdc++.h>
using namespace std;
long long a[1000006];
int main() {
  long long n, m;
  scanf("%I64d %I64d", &n, &m);
  int i;
  memset(a, 0, sizeof(a));
  for (i = 1; i <= m; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    a[x]++;
    a[y]++;
  }
  long long sum = 0;
  for (i = 1; i <= n; i++) {
    sum += a[i] * (n - 1 - a[i]);
  }
  sum = sum / 2;
  long long nima = n * (n - 1) * (n - 2) / 6;
  printf("%I64d\n", nima - sum);
}
