#include <bits/stdc++.h>
using namespace std;
int N, M;
long long ans;
int sz[1000002];
int main() {
  scanf("%d%d", &N, &M);
  for (int i = 0, x, y; i < M; i++) {
    scanf("%d%d", &x, &y);
    sz[x]++, sz[y]++;
  }
  for (int i = 1; i <= N; i++) {
    long long x = sz[i], y = N - sz[i] - 1;
    ans += x * (x - 1) + y * (y - 1) - x * y;
  }
  printf("%I64d\n", ans / 6);
  return 0;
}
