#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
long long deg[N];
int main() {
  int n, m;
  while (scanf("%d%d", &n, &m) != EOF) {
    memset(deg, 0, sizeof(deg));
    for (int i = 0; i < m; i++) {
      int a, b;
      scanf("%d%d", &a, &b);
      deg[a]++;
      deg[b]++;
    }
    long long ans = (long long)n * (n - 1) * (n - 2) / 6;
    long long sum = 0;
    for (int i = 1; i <= n; i++) {
      sum += deg[i] * (n - 1 - deg[i]);
    }
    cout << ans - sum / 2 << endl;
  }
  return 0;
}
