#include <bits/stdc++.h>
using namespace std;
int n, m, t, i, j, k;
long long a[2000005];
long long ans, sum;
int main() {
  scanf("%d%d", &n, &m);
  for (i = 1; i <= m * 2; i++) {
    scanf("%d", &t);
    a[t]++;
  }
  for (i = 1; i <= n; i++) ans += a[i] * (n - 1 - a[i]);
  printf("%lld\n", (long long)n * (n - 1) * (n - 2) / 6 - ans / 2);
  return 0;
}
