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