#include <bits/stdc++.h>
using namespace std;
int Get() {
  char c;
  while (c = getchar(), c < '0' || c > '9')
    ;
  int X = c - 48;
  while (c = getchar(), c >= '0' && c <= '9') X = X * 10 + c - 48;
  return X;
}
int main() {
  int N = Get(), M = Get() * 2;
  static int Degree[1000000];
  memset(Degree, 0, sizeof(Degree));
  for (int i = 0; i < M; i++) Degree[Get() - 1]++;
  long long Ans = 0;
  for (int i = 0; i < N; i++) {
    long long A = Degree[i], B = N - 1 - A;
    Ans += A * A + B * B - A * B - A - B;
  }
  cout << Ans / 6 << endl;
  return 0;
}
