#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e6 + 4;
const int K = 100;
const int inf = (int)1e9 + 7;
long long g[N];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a, --b;
    g[a]++;
    g[b]++;
  }
  long long ans = (long long)n * (n - 1) * (n - 2) / 6, s = 0;
  for (int i = 0; i < n; ++i) {
    s += (n - 1 - g[i]) * g[i];
  }
  ans -= s / 2;
  printf("%lld", ans);
  return 0;
}
