#include <bits/stdc++.h>
using namespace std;
int ntest = 0, test = 0;
inline void init();
inline void run();
inline void stop() { ntest = test - 1; }
int main() {
  init();
  while (++test <= ntest) {
    run();
  }
  return 0;
}
const int INF = (int)1E9 + 5;
const double EPS = 1E-11;
const long long MOD = (long long)1E9 + 7;
const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, -1, 1, 0};
inline void init() { ntest = 1; }
int cnt[(int)(1e6 + 5)];
inline void run() {
  int n, m, a, b;
  cin >> n >> m;
  for (int i = 0; i < (m); i++) {
    scanf("%d%d", &a, &b);
    cnt[a]++;
    cnt[b]++;
  }
  long long x = 0;
  for (int i = (1); i <= (n); i++) x += (n - 1 - cnt[i]) * cnt[i];
  x /= 2;
  cout << (n - 1ll) * n * (n - 2ll) / 6 - x;
}
