#include <bits/stdc++.h>
inline int RD() {
  int x;
  scanf("%d", &x);
  return x;
}
inline int RD(int& x) { return x = RD(); }
inline void RD(int& x, int& y) { RD(x), RD(y); }
using namespace std;
const static int N = 1000010;
int cnt[N];
int n, m, x, y;
int main() {
  RD(n, m);
  long long ans = (long long)n * (n - 1) * (n - 2) / 6;
  for (int i = (1); i <= (m); i++) {
    RD(x, y);
    ans -= n - 2 - cnt[x] - cnt[y];
    cnt[x]++;
    cnt[y]++;
  }
  cout << ans << endl;
  return 0;
}
