#include <bits/stdc++.h>
using namespace std;
int m;
long long n;
long long deg[1001001], result;
vector<vector<int> > e;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    deg[a]++;
    deg[b]++;
  }
  result = 0;
  for (int i = 1; i <= n; i++) result += (n - 1 - deg[i]) * deg[i];
  result /= 2;
  result = n * (n - 1) * (n - 2) / 6 - result;
  cout << result;
}
