#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000 * 1000;
unsigned long long int d[MAXN];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    d[a]++;
    d[b]++;
  }
  unsigned long long int ans = n;
  ans *= ans - 1;
  ans *= n - 2;
  ans /= 6;
  unsigned long long int t = 0;
  for (int i = 0; i < n; i++) t += (n - d[i] - 1) * d[i];
  t /= 2;
  ans -= t;
  cout << ans << endl;
  return 0;
}
