#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long grades[1000010];
int main() {
  while (cin >> n >> m) {
    memset(grades, 0, sizeof grades);
    for (int i = 0, a, b; i < m; i++) {
      scanf("%d%d", &a, &b);
      a--;
      b--;
      grades[a]++;
      grades[b]++;
    }
    long long resp = (n * (n - 1) * (n - 2)) / 6, aux = 0;
    for (int i = 0; i < n; i++) {
      aux += (grades[i] * (n - 1 - grades[i]));
    }
    cout << resp - aux / 2 << endl;
  }
  return 0;
}
