#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-7;
const long double PI = acos(0.0) * 2.0;
mt19937_64 rng((unsigned long long)new char);
const int mod = 1e9 + 7;
const long long INF = 9e18;
const int maxn = 1e6 + 100;
int n;
int m;
int d[maxn];
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  for (int t = (0); t < (m); ++t) {
    int u, v;
    cin >> u >> v;
    ++d[u], ++d[v];
  }
  long long ans = (long long)n * (n - 1) * (n - 2) / 6;
  long long s = 0;
  for (int t = (1); t < (n + 1); ++t) {
    s += (long long)d[t] * (n - 1 - d[t]);
  }
  ans -= s / 2;
  cout << ans;
}
