#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  int k;
  cin >> n >> m;
  vector<int> g(n);
  for (int i = 0; i < n; i++) g[i] = 0;
  long long ans = (n - 2) * (2 * m), ans1 = 0;
  for (int i = 0; i < 2 * m; i++) {
    scanf("%d", &k);
    ans1 += 2 * g[k - 1];
    g[k - 1]++;
  }
  ans -= ans1;
  ans = ((n * (n - 1) * (n - 2)) / 6) - (ans / 2);
  cout << ans << endl;
}
