#include <bits/stdc++.h>
using namespace std;
template <class T1, class T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  os << "{" << p.first << "," << p.second << "}";
  return os;
}
const int N = 1e6 + 5;
const int oo = 1e9 + 7;
int deg[N];
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m;
  cin >> n >> m;
  while (m--) {
    long long u, v;
    cin >> u >> v;
    deg[u]++;
    deg[v]++;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    long long d = deg[i];
    ans += d * (n - d - 1);
  }
  ans /= 2;
  ans = n * (n - 1) / 2 * (n - 2) / 3 - ans;
  cout << ans << "\n";
}
