#include <bits/stdc++.h>
using namespace std;
const int INFint = 2e9;
const long long INF = 2e18;
const long long MOD = 1000000007ll;
int main() {
  ios_base::sync_with_stdio(0);
  int n, m;
  scanf("%d%d", &n, &m);
  vector<int> deg(n + 1);
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    deg[a]++;
    deg[b]++;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    long long d = deg[i];
    ans += d * (d - 1) + (n - d - 1) * (n - d - 2) - d * (n - d - 1);
  }
  cout << ans / 6;
  fprintf(stderr, "\nTIME = %lf\n", 1.0 * clock() / CLOCKS_PER_SEC);
  ;
  return 0;
}
