#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX;
const bool debug = true;
const long long INFL = LLONG_MAX;
const int output_precision = 15;
stringstream ss;
int N, M;
long long ans, cnt[1001001];
int main() {
  ios_base::sync_with_stdio(0);
  cout.precision(output_precision);
  cout << fixed;
  ss.precision(output_precision);
  ss << fixed;
  cin >> N >> M;
  for (int(i) = 1, j = M; (i) <= j; (i)++) {
    int foo, bar;
    cin >> foo >> bar;
    cnt[foo]++;
    cnt[bar]++;
  }
  for (int(i) = 1, j = N; (i) <= j; (i)++) {
    ans += cnt[i] * (N - 1 - cnt[i]);
  }
  ans >>= 1;
  cout << (1LL * N * (N - 1) * (N - 2) / 6 - ans) << '\n';
}
