#include <bits/stdc++.h>
using namespace std;
const int MAXX = 1000 * 1000 + 5;
long long edge[MAXX];
int main() {
  long long n, m, x, y;
  ios::sync_with_stdio(0);
  cin >> n >> m;
  for (long long i = 1; i <= m; i++) {
    cin >> x >> y;
    edge[x]++;
    edge[y]++;
  }
  long long ans = (n * (n - 1) * (n - 2)) / 6 - (n - 2) * m;
  for (long long i = 1; i <= n; i++) {
    ans += (edge[i] * (edge[i] - 1) / 2);
  }
  cout << ans << endl;
  return 0;
}
