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