#include <bits/stdc++.h>
using namespace std;
const int NMAX = 1e6 + 7;
int n, m, d[NMAX];
long long ans = 0;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  while (m--) {
    int x, y;
    cin >> x >> y;
    d[x]++;
    d[y]++;
  }
  ans = 1LL * n * (n - 1) * (n - 2) / 6;
  long long tmp = 0;
  for (int i = 1; i <= n; i++) tmp += 1LL * d[i] * (n - d[i] - 1);
  cout << ans - tmp / 2;
  return 0;
}
