#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9;
int main() {
  ios_base::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  vector<long long> pow(n + 1, 0ll);
  vector<pair<int, int> > E;
  while (m--) {
    int a, b;
    cin >> a >> b;
    pow[a]++;
    pow[b]++;
    E.push_back(make_pair(a, b));
    E.push_back(make_pair(b, a));
  }
  long long a = 0;
  for (auto e : E) {
    int v = e.first;
    int u = e.second;
    a += (n - pow[v] - 1);
  }
  a /= 2;
  long long res = 1ll * n * (n - 1) * (n - 2) / 6ll - a;
  cout << res << endl;
  return 0;
}
