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