#include <bits/stdc++.h>
using namespace std;
int const MAX_N = 1e6 + 10;
struct q_t {
  int a, b;
};
int n, m, cnt1[MAX_N], cnt2[MAX_N];
long long answer, buffer;
q_t q[MAX_N];
int main() {
  scanf("%d %d", &n, &m);
  answer = 1LL * n * (n - 1) * (n - 2) / 6LL;
  for (int i = 0; i < n; ++i) cnt1[i] = n - 1;
  for (int i = 0; i < m; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    --a;
    --b;
    q[i] = q_t{a, b};
  }
  for (int i = 0; i < m; ++i) {
    --cnt1[q[i].a];
    --cnt1[q[i].b];
    ++cnt2[q[i].a];
    ++cnt2[q[i].b];
  }
  for (int i = 0; i < n; ++i) {
    buffer += 1LL * cnt1[i] * cnt2[i];
  }
  buffer /= 2;
  printf("%I64d\n", answer - buffer);
  return 0;
}
