#include <bits/stdc++.h>
using namespace std;
static const int INF = 500000000;
template <class T>
void debug(T a, T b) {
  for (; a != b; ++a) cerr << *a << ' ';
  cerr << endl;
}
int n, m;
pair<int, int> es[1000005];
int deg[1000005];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    scanf("%d%d", &es[i].first, &es[i].second);
    --es[i].first;
    --es[i].second;
    ++deg[es[i].first], ++deg[es[i].second];
  }
  long long int res = n * (long long int)(n - 1) * (n - 2) / 6, sub = 0;
  for (int i = 0; i < n; ++i) sub += deg[i] * (long long int)(n - 1 - deg[i]);
  res -= sub / 2;
  cout << res << endl;
  return 0;
}
