#include <bits/stdc++.h>
using namespace std;
const int INF = ~0U >> 1;
const double eps = 1e-6;
int n, m, cnt[1100000];
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    cnt[x]++;
    cnt[y]++;
  }
  long long tot = (long long)(n) * (n - 1) * (n - 2) / 6;
  long long bad = 0;
  for (int i = 1; i <= n; i++) bad += cnt[i] * (n - 1 - cnt[i]);
  cout << tot - bad / 2 << endl;
  return 0;
}
