#include <bits/stdc++.h>
const int N = 1000010;
const int inf = 0x3f3f3f3f;
using namespace std;
int n, m;
int c[N];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    c[a]++;
    c[b]++;
  }
  if (n < 3) return puts("0"), 0;
  long long ret = 0;
  for (int i = 1; i <= n; i++) ret += 1ll * c[i] * (n - 1 - c[i]);
  ret /= 2;
  cout << (1ll * n * (n - 1) * (n - 2) / 6 - ret) << endl;
  return 0;
}
