#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000000 + 10;
long long G[MAXN];
long long n, m;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  long long ans = (n * (n - 1) * (n - 2)) / 6;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    G[a]++;
    G[b]++;
  }
  ans -= m * (n - 2);
  for (int i = 1; i <= n; i++) ans += G[i] * (G[i] - 1) / 2;
  cout << ans << endl;
  return 0;
}
