#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = double;
const int mxn = 1e5 + 10;
const ll inf = 1e18;
ll c(ll n) { return n * (n - 1) / 2; }
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> d(n + 1, 0);
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    d[u]++;
    d[v]++;
  }
  ll sum = 0;
  for (int i = 1; i <= n; i++) {
    sum += c(d[i]) * 2 - d[i] * (n - 1 - d[i]) + 2 * c(n - 1 - d[i]);
  }
  sum /= 6;
  cout << sum << '\n';
  return 0;
}
