#include <bits/stdc++.h>
using namespace std;
const int oo = 1e9 + 7;
vector<int> cnt;
long long n, m;
long long cur = 0;
int main() {
  scanf("%lld %lld", &n, &m);
  cnt.assign(n + 1, 0);
  for (int i = 0; i < m; ++i) {
    long long u, v;
    scanf("%lld %lld", &u, &v);
    cnt[u]++;
    cnt[v]++;
  }
  for (int i = 1; i <= n; ++i) {
    if (!cnt[i]) continue;
    cur += (n - 1 - cnt[i]) * cnt[i];
  }
  long long res = n * (n - 1) * (n - 2) / 6 - cur / 2;
  printf("%lld\n", res);
}
