#include <bits/stdc++.h>
using namespace std;
int f[1000000 + 5];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    f[x]++;
    f[y]++;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) ans += 1LL * f[i] * (n - 1 - f[i]);
  ans /= 2;
  ans = 1LL * n * (n - 1) * (n - 2) / 6 - ans;
  cout << ans;
  return 0;
}
