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