#include <bits/stdc++.h>
using namespace std;
int deg[1000005] = {0};
int main() {
  int n, m;
  scanf("%d", &n);
  scanf("%d", &m);
  for (int i = (int)(1); i <= (int)(m); i++) {
    int x, y;
    scanf("%d", &x);
    scanf("%d", &y);
    deg[x]++;
    deg[y]++;
  }
  long long ans = (1LL * n * (n - 1) * (n - 2)) / 6 - 1LL * m * (n - 2);
  for (int i = (int)(1); i <= (int)(n); i++)
    ans += 1LL * deg[i] * (deg[i] - 1) / 2;
  printf("%I64d", ans);
}
