#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
using uLL = unsigned long long int;
using uint = unsigned int;
using ld = long double;
const int N = 1000007;
int tab[N];
int main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  LL ans = LL(n) * (n - 1) * (n - 2) / 6;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    ans -= n - 2 - tab[a] - tab[b];
    tab[a]++;
    tab[b]++;
  }
  cout << ans << '\n';
  return 0;
}
