#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
int degree[N];
int n, m, u, v;
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &u, &v);
    degree[u]++;
    degree[v]++;
  }
  long long sum = 0LL, ans = n * 1LL * (n - 1) * (n - 2) / 6;
  for (int i = 1; i <= n; i++) {
    sum += degree[i] * 1LL * (n - 1 - degree[i]);
  }
  cout << ans - sum / 2 << endl;
  return 0;
}
