#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const double eps = 1e-9;
const double pi = acos(-1.0);
const int maxn = (int)1e6 + 10;
int deg[maxn];
int main() {
  int n, m, a, b;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &a, &b);
    --a;
    --b;
    deg[a]++;
    deg[b]++;
  }
  long long sum = 0;
  for (int i = 0; i < n; i++) sum = sum + deg[i] * (n - 1 - deg[i]);
  sum /= 2;
  long long cur = 1;
  cur = cur * n * (n - 1) * (n - 2) / 3 / 2;
  cout << cur - sum << endl;
  return 0;
}
