#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
const int M = 100005;
int a[N];
int main() {
  int i, j, k;
  int n, m;
  int x, y;
  while (scanf("%d%d", &n, &m) != EOF) {
    memset(a, 0, sizeof(a));
    for (i = 0; i < m; i++) {
      scanf("%d%d", &x, &y);
      a[x]++;
      a[y]++;
    }
    long long sum = 0, ans = (long long)n * (n - 1) * (n - 2) / 6;
    for (i = 1; i <= n; i++) sum += (long long)a[i] * (n - 1 - a[i]);
    printf("%I64d\n", ans - sum / 2);
  }
  return 0;
}
