#include <bits/stdc++.h>
using namespace std;
template <class T>
void debug(T begin, T end) {
  for (T i = begin; i != end; ++i) cout << *i << " ";
  cout << endl;
}
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int main() {
  long long N, M;
  while (cin >> N >> M) {
    long long ans = N * (N - 1) * (N - 2) / 6;
    int cnt[1000001] = {};
    for (int i = (0); i < (int)M; ++i) {
      int a, b;
      scanf("%d %d", &a, &b);
      ans -= N - 2 - cnt[a] - cnt[b];
      cnt[a]++;
      cnt[b]++;
    }
    cout << ans << endl;
  }
  return 0;
}
