#include <bits/stdc++.h>
using namespace std;
template <typename T>
T abs(T x) {
  return x > 0 ? x : -x;
}
const int maxn = 1000005;
int deg[maxn];
int main(int argc, char *argv[]) {
  int n, m;
  scanf("%d %d", &n, &m);
  long long ans = (long long)n * (n - 1) * (n - 2) / 6;
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    deg[u]++;
    deg[v]++;
    ans -= n - 2;
  }
  for (int i = 0; i < maxn; i++) ans += (long long)deg[i] * (deg[i] - 1) / 2;
  cout << ans << endl;
  return 0;
}
