#include <bits/stdc++.h>
using namespace std;
long long arr[1000001];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  if (n == 1 || n == 2) {
    printf("0\n");
    return 0;
  }
  long long ans = (long long)n * (n - 1) * (n - 2) / 6;
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    ans -= (long long)(n - 2);
    ans += arr[a];
    ans += arr[b];
    arr[a]++;
    arr[b]++;
  }
  printf("%I64d\n", ans);
  return 0;
}
