#include <bits/stdc++.h>
using namespace std;
int mas[1000001];
int main() {
  int m, n = 0;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    mas[a]++;
    mas[b]++;
  }
  long long count = 0;
  for (int i = 1; i <= n; i++) {
    count += (long long)mas[i] * (long long)(n - 1 - mas[i]);
  }
  count = count / 2;
  long long soch = ((long long)n * ((long long)n - 1)) / 2;
  soch *= (long long)n - 2;
  soch = soch / 3;
  cout << soch - count;
  return 0;
}
