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