#include <bits/stdc++.h>
using namespace std;
const int INF = 999999999;
const double EPSILON = 0.00000001;
const long long MOD = 1000000007;
long long deg[1000005];
int main() {
  long long v, e;
  memset(deg, 0, sizeof(deg));
  cin >> v >> e;
  for (int i = 0; i < e; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    deg[a - 1]++;
    deg[b - 1]++;
  }
  long long minus = 0;
  for (int i = 0; i < v; i++) {
    minus += deg[i] * (v - 1 - deg[i]);
  }
  minus /= 2;
  long long ans = v * (v - 1) * (v - 2) / 6 - minus;
  cout << ans << endl;
  return 0;
}
