#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
using namespace std;
template <typename T>
void uin(T &a, T b) {
  if (b < a) {
    a = b;
  }
}
template <typename T>
void uax(T &a, T b) {
  if (b > a) {
    a = b;
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, m;
  cin >> n >> m;
  vector<long long> deg(n + 1);
  for (long long i = 0; i < m; ++i) {
    long long u, v;
    cin >> u >> v;
    ++deg[u];
    ++deg[v];
  }
  long long bad = 0;
  for (long long i = 1; i <= n; ++i) {
    bad += deg[i] * (n - deg[i] - 1);
  }
  bad /= 2;
  long long res = n * (n - 1) * (n - 2) / 6 - bad;
  cout << res << '\n';
  return 0;
}
