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