#include <bits/stdc++.h>
using namespace std;
int deg[1111111];
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    --x, --y;
    ++deg[x], ++deg[y];
  }
  long long otm = 0;
  for (int i = 0; i < n; ++i) {
    otm += 1LL * deg[i] * (n - 1 - deg[i]);
  }
  otm /= 2;
  if (n < 3) {
    puts("0");
    return 0;
  }
  long long res = 1LL * n * (n - 1) * (n - 2) / 6;
  cout << res - otm << endl;
  return 0;
}
