#include <bits/stdc++.h>
using namespace std;
long long d[1000002];
long long n, m, ans, u, v, res;
int main() {
  scanf("%I64d %I64d", &n, &m);
  ans = n * (n - 1LL) * (n - 2LL) / 6;
  while (m--) {
    scanf("%I64d %I64d", &u, &v);
    ans -= (n - (++d[u]) - (++d[v]));
  }
  cout << ans;
}
