#include <bits/stdc++.h>
using namespace std;
int d[1000010];
int main() {
  long long n, m;
  int t1, t2;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &t1, &t2);
    d[t1]++;
    d[t2]++;
  }
  long long tot = (long long)1 * n * (n - 1) * (n - 2) / 6;
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    sum += (d[i]) * (n - d[i] - 1);
  }
  sum /= 2;
  cout << tot - sum << endl;
}
