#include <bits/stdc++.h>
using namespace std;
int ar[(int)1e6 + 10];
int main() {
  int N, M;
  cin >> N >> M;
  while (M--) {
    int a, b;
    scanf(" %d %d", &a, &b);
    ar[a]++, ar[b]++;
  }
  long long res = 1LL * N * (N - 1) * (N - 2) / 6;
  long long no = 0;
  for (int i = 1; i <= N; i++) no += 1LL * ar[i] * (N - 1 - ar[i]);
  cout << res - no / 2 << endl;
  return 0;
}
