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