#include <bits/stdc++.h>
using namespace std;
int n, m;
long long degree[1000010] = {0};
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    degree[u]++, degree[v]++;
  }
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    long long a = degree[i], b = n - a - 1;
    sum = sum + a * (a - 1) + b * (b - 1) - a * b;
  }
  cout << sum / 6;
}
