#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000001;
const int INF = 0x7FFFFFFF;
const double eps = 1e-8;
const double pi = acos(-1.0);
long long n, m;
long long color[MAXN];
void init() {
  cin >> n >> m;
  memset(color, 0, sizeof(color));
  int x, y;
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    ++color[x];
    ++color[y];
  }
}
void solve() {
  long long ret = 0;
  for (int i = 1; i <= n; i++) ret += color[i] * (n - 1 - color[i]);
  cout << n * (n - 1) * (n - 2) / 6 - ret / 2 << endl;
}
int main() {
  ios::sync_with_stdio(0);
  init();
  solve();
  return 0;
}
