#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000007;
long long In[maxn], Out[maxn];
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) In[i] = 0, Out[i] = n - 1;
  for (int i = 1; i <= m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    In[a]++, In[b]++;
    Out[a]--, Out[b]--;
  }
  if (n < 3)
    puts("0");
  else {
    long long res = (long long)n * (n - 1) * (n - 2) / 6;
    long long Det = 0;
    for (int i = 1; i <= n; i++) Det += In[i] * Out[i];
    res -= Det / 2;
    cout << res << endl;
  }
  return 0;
}
