#include <bits/stdc++.h>
using namespace std;
const int N = 1e6;
int d[N + 2];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  long long ans = 1LL * n * (n - 1) * (n - 2) / 6;
  ans -= 1LL * (n - 2) * m;
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    d[u]++, d[v]++;
  }
  for (int i = 1; i <= n; i++) ans += 1LL * d[i] * (d[i] - 1) / 2;
  cout << ans << endl;
  return 0;
}
