#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (a == 0)
    return (b);
  else
    return (gcd(b % a, a));
}
long long int fastpow(long long int a, long long int n, long long int temp) {
  if (n == 0) return (1);
  if (n == 1) return ((a * temp) % 1000000007);
  if (n & 1) temp = (temp * a) % 1000000007;
  return (fastpow((a * a) % 1000000007, n / 2, temp));
}
char dum;
long long int x[1000006] = {0}, a, b;
int main() {
  ios::sync_with_stdio(false);
  long long int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    x[a]++, x[b]++;
  }
  long long int extra = 0;
  for (int i = 1; i < n + 1; i++) {
    extra = extra + x[i] * (n - 1 - x[i]);
  }
  cout << (n * (n - 1) * (n - 2)) / 6 - extra / 2 << endl;
  return 0;
}
