#include <bits/stdc++.h>
using namespace std;
const int maxint = -1u >> 1;
const double pi = 3.14159265358979323;
const double eps = 1e-8;
int n, m, cnt[1000010];
long long ans;
int main() {
  int u, v;
  scanf("%d%d", &n, &m);
  if (n < 3) {
    puts("0");
  } else {
    memset(cnt, 0, sizeof(cnt));
    ans = (1LL * n * (n - 1) / 2) * (n - 2) / 3;
    for (int i = (0); i < (m); i++) {
      scanf("%d%d", &u, &v);
      cnt[u]++;
      cnt[v]++;
    }
    long long sum = 0;
    for (int i = (1); i < (n + 1); i++) sum += 1LL * cnt[i] * (n - 1 - cnt[i]);
    ans -= sum / 2;
    cout << ans << endl;
  }
  return 0;
}
