#include <bits/stdc++.h>
using namespace std;
int d[1000007];
long long int n, m;
int main() {
  long long int r;
  scanf("%d %d", &n, &m);
  r = n * (n - 1) * (n - 2) / 6;
  int a, b;
  while (m--) {
    scanf("%d %d", &a, &b);
    r -= n - (++d[a]) - (++d[b]);
  }
  cout << r << "\n";
  return 0;
}
