#include <bits/stdc++.h>
using namespace std;
long long sum, ans;
int degree[1000011];
int main() {
  long long n, m;
  long long v1, v2, i;
  ios::sync_with_stdio(0);
  while (cin >> n >> m) {
    for (i = 0; i < n; i++) degree[i] = 0;
    for (i = 0; i < m; i++) {
      cin >> v1 >> v2;
      degree[v1 - 1]++;
      degree[v2 - 1]++;
    }
    sum = 0;
    for (i = 0; i < n; i++) {
      sum += (degree[i] * (n - 1 - degree[i]));
    }
    sum /= 2;
    ans = n * (n - 1) * (n - 2) / 6 - sum;
    cout << ans << endl;
  }
  return 0;
}
