#include <bits/stdc++.h>
using namespace std;
int c[1000000];
int main() {
  ios::sync_with_stdio(false);
  unsigned long long m, n, a, b;
  cin >> n >> m;
  unsigned long long ans = 0;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    c[a]++;
    c[b]++;
  }
  unsigned long long sum = 0;
  for (int i = 1; i <= n; i++) sum += c[i] * (n - c[i] - 1);
  sum /= 2;
  ans = (n * (n - 1) * (n - 2) / 6) - sum;
  cout << ans << endl;
  return 0;
}
