#include <bits/stdc++.h>
using namespace std;
long long int n, m;
long long int dp[1000005];
int main() {
  int a, b;
  scanf("%d", &a);
  scanf("%d", &b);
  n = a;
  m = b;
  for (long long int i = 0; i < m; i++) {
    int x, y;
    scanf("%d", &x);
    scanf("%d", &y);
    dp[x]++;
    dp[y]++;
  }
  long long int k = 0;
  for (long long int i = 0; i < n; i++) {
    k += dp[i + 1] * (n - dp[i + 1] - 1);
  }
  k /= 2;
  cout << n * (n - 1) * (n - 2) / 6 - k;
  return 0;
}
