#include <bits/stdc++.h>
using namespace std;
const int MAX = 1000006;
int d[MAX];
int main() {
  ios::sync_with_stdio(false);
  int N, i, u, v, M;
  cin >> N >> M;
  for (i = 0; i < M; ++i) {
    cin >> u >> v;
    d[u]++, d[v]++;
  }
  long long remove = 0;
  for (i = 1; i <= N; ++i) {
    remove += d[i] * 1LL * (N - d[i] - 1);
  }
  remove >>= 1;
  cout << N * 1LL * (N - 1) * (N - 2) / 6 - remove << endl;
  return 0;
}
