#include <bits/stdc++.h>
using namespace std;
unsigned long long int n, m, l;
int neig[1000001];
int main(int argc, char** argv) {
  cin >> n >> m;
  int a, b;
  for (int i = 0; i < m; ++i) {
    scanf("%i%i", &a, &b);
    neig[a]++;
    neig[b]++;
  }
  unsigned long long int res = 0;
  for (int i = 1; i <= n; ++i) {
    res += neig[i] * neig[i];
  }
  res = res / 2;
  res += n * (n - 1) * (n - 2) / 6;
  res -= m * (n - 1);
  cout << res;
  return 0;
}
