#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 3;
long long n, m;
long long deg1[N], deg2[N];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (long long i = 0; i < m; i++) {
    long long a, b;
    cin >> a >> b;
    deg1[a]++;
    deg1[b]++;
  }
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    deg2[i] = n - 1 - deg1[i];
    ans += deg1[i] * deg2[i];
  }
  cout << n * (n - 1) * (n - 2) / 6 - ans / 2;
}
