#include <bits/stdc++.h>
using namespace std;
long long have[1000100];
long long nohave[1000100];
long long sol = 0;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) have[i] = n - 1;
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    u--;
    v--;
    have[u]--;
    have[v]--;
    nohave[u]++;
    nohave[v]++;
  }
  for (int i = 0; i < n; i++) {
    sol -= nohave[i] * have[i];
    sol += (nohave[i] - 1ll) * nohave[i];
    sol += (have[i] - 1ll) * have[i];
  }
  cout << sol / 6ll << endl;
  return 0;
}
