#include <bits/stdc++.h>
inline long long gcd(long long a, long long b) {
  return (b ? gcd(b, a % b) : a);
}
inline long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
inline int cmp(double x, double y = 0, double tol = 1e-7) {
  return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}
using namespace std;
const int MAXN = 1000006;
int v[MAXN];
int main() {
  memset(v, 0, sizeof v);
  int n, m, x, y;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &x, &y);
    v[x]++;
    v[y]++;
  }
  n--;
  long long ans = 0;
  for (int i = 1; i < n + 2; i++) {
    long long a = v[i];
    ans += a * (a - 1);
    ans += (n - a) * (n - a - 1);
    ans -= a * (n - a);
  }
  cout << ans / 6 << endl;
}
