#include <bits/stdc++.h>
using namespace std;
int n, m;
long long d[1000100], ans, A;
int main() {
  memset(d, 0, sizeof(d));
  scanf("%d%d", &n, &m);
  for (int i = 1, x, y; i <= m; ++i) scanf("%d%d", &x, &y), ++d[x], ++d[y];
  A = (long long)n * (n - 1) / 2 * (n - 2) / 3;
  ans = 0;
  for (int i = 1; i <= n; ++i) ans += d[i] * (n - 1 - d[i]);
  cout << A - ans / 2 << endl;
  return 0;
}
