#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 7;
long long d[N];
int32_t main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  long long n, m;
  cin >> n >> m;
  for (long long i = 1; i <= m; i++) {
    long long u, v;
    cin >> u >> v;
    d[u]++;
    d[v]++;
  }
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    ans += (d[i] * (d[i] - 1)) - d[i] * (n - 1 - d[i]) +
           (n - 1 - d[i]) * (n - 1 - d[i] - 1);
  }
  cout << ans / 6LL << endl;
}
