#include <bits/stdc++.h>
using namespace std;
const double eps(1e-8);
long long d[1000010];
long long n, m;
int main() {
  scanf("%lld %lld", &n, &m);
  for (int i = (1); i <= (m); ++i) {
    long long a, b;
    scanf("%lld %lld", &a, &b);
    d[a]++;
    d[b]++;
  }
  long long ans = 0;
  for (int i = (1); i <= (n); ++i) ans += d[i] * (n - 1 - d[i]);
  cout << n * (n - 1) * (n - 2) / 6 - ans / 2 << endl;
}
