#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 1e6 + 5;
int n, m;
long long ans, cnt;
int deg[MAXN];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    deg[x]++;
    deg[y]++;
  }
  ans = (long long)n * (n - 1) * (n - 2) / 6;
  for (int i = 1; i <= n; i++) cnt += deg[i] * (n - 1 - deg[i]);
  printf("%lld\n", ans - cnt / 2);
  return 0;
}
