#include <bits/stdc++.h>
using namespace std;
const int INF = ~(1 << 31);
const double EPS = 1;
const double PI = 3.141592653589793;
int main() {
  int n, m, a, b;
  cin >> n >> m;
  vector<int> cnt(n);
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &a, &b);
    cnt[a - 1]++;
    cnt[b - 1]++;
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans += (long long)cnt[i] * (n - cnt[i] - 1);
  }
  cout << (long long)n * (n - 1) * (n - 2) / 6 - ans / 2 << endl;
  return 0;
}
