#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000,100000000")
using namespace std;
const long long inf = 1e18 + 7;
const long long mod = 1e9 + 7;
const double eps = 1e-10;
const double PI = 2 * acos(0.0);
const double E = 2.71828;
const long long maxn = 1000005LL;
long long cnt[maxn];
int main(void) {
  long long n, m;
  cin >> n >> m;
  for (long long(i) = 0; (i) < (long long)(m); (i)++) {
    long long x, y;
    scanf("%I64d%I64d", &x, &y);
    x--;
    y--;
    cnt[x]++;
    cnt[y]++;
  }
  long long rez = n * (n - 1) * (n - 2) / 6, Cnt = 0;
  for (long long(i) = 0; (i) < (long long)(n); (i)++) {
    Cnt += cnt[i] * (n - 1 - cnt[i]);
  }
  Cnt /= 2;
  cout << rez - Cnt << endl;
  return 0;
}
