#include <bits/stdc++.h>
using namespace std;
unsigned long long deg[2000000], deg2[2000000];
unsigned long long n, m, a, b;
unsigned long long x1 = 0, x2 = 0;
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &a, &b);
    a--, b--;
    deg[a]++;
    deg[b]++;
  }
  for (int i = 0; i < n; i++) {
    deg2[i] = n - 1 - deg[i];
    x1 += deg[i] * (deg[i] - 1) / 2;
    x2 += deg2[i] * (deg2[i] - 1) / 2;
  }
  unsigned long long a1 = x1 + x2;
  unsigned long long a2 = n * (n - 1) * (n - 2) / 3;
  cout << (2 * a1 - a2) / 4;
  return 0;
}
