#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[1010000];
int main() {
  scanf("%d%d", &n, &m);
  int i;
  for (i = 1; i <= n; ++i) a[i] = 0;
  for (i = 0; i < m; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    a[x]++;
    a[y]++;
  }
  long long t = 1ll * n * (n - 1) * (n - 2) / 6;
  long long all = 0;
  for (i = 1; i <= n; ++i) {
    all += 1ll * (n - 1 - a[i]) * a[i];
  }
  cout << t - all / 2 << endl;
}
