#include <bits/stdc++.h>
using namespace std;
long long A[1000000];
int main() {
  cin.tie(NULL)->sync_with_stdio(false);
  long long n, m;
  cin >> n >> m;
  int u, v;
  for (int i = 0; i < m; ++i) {
    cin >> u >> v;
    A[--u] += 1;
    A[--v] += 1;
  }
  long long mx = 0;
  for (int i = 0; i < n; ++i)
    mx += A[i] * (A[i] - 1) - A[i] * (n - A[i] - 1) +
          (n - A[i] - 1) * (n - A[i] - 2);
  cout << mx / 6;
  return 0;
}
