#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e6 + 10;
long long cnt[MAX];
int main() {
  int nn, mm;
  scanf("%d%d", &nn, &mm);
  long long n = nn, m = mm;
  if (n < 3) {
    cout << 0;
    return 0;
  }
  long long ans = 0;
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    cnt[u]++;
    cnt[v]++;
  }
  ans = n * (n - 1) * (n - 2) / 6;
  ans -= m * (n - 2);
  for (int i = 1; i <= n; i++) {
    if (cnt[i] > 1) ans += cnt[i] * (cnt[i] - 1) / 2;
  }
  cout << ans;
}
