#include <bits/stdc++.h>
using namespace std;
long long i, n, m, a[1000001], t1, t2, sum;
int main() {
  cin >> n >> m;
  for (i = 0; i < m; i++) {
    scanf("%I64d %I64d", &t1, &t2);
    a[t1]++;
    a[t2]++;
  }
  for (i = 1; i <= n; i++) sum += a[i] * (n - 1LL - a[i]);
  sum /= 2LL;
  cout << n * (n - 1LL) * (n - 2LL) / 6LL - sum << endl;
}
