#include <bits/stdc++.h>
using namespace std;
int d[1000001] = {0};
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0, a, b; i < m; ++i) scanf("%d%d", &a, &b), d[a]++, d[b]++;
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    long long de = d[i], ade = n - 1 - de;
    ans += de * (de - 1) + ade * (ade - 1) - de * ade;
  }
  cout << ans / 6 << endl;
  return 0;
}
