#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, -1, 1};
int dy[] = {-1, 1, 0, 0};
const int N = 1e6 + 5;
long long ans, sum, d[N];
int n, m;
int main() {
  int a, b;
  while (~scanf("%d%d", &n, &m)) {
    memset(d, 0, sizeof(d));
    for (int i = 0; i < (m); ++i) {
      scanf("%d%d", &a, &b);
      d[a]++, d[b]++;
    }
    if (n < 3) {
      puts("0");
      continue;
    }
    ans = (long long)n * (n - 1) * (n - 2) / 6;
    sum = 0;
    for (int i = (1); i <= (n); ++i) sum += d[i] * (n - 1 - d[i]);
    sum /= 2;
    printf("%lld\n", ans - sum);
  }
  return 0;
}
