#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007LL;
set<int> adj[1000100];
long long cnt[1000100];
long long intersection(int x, int y) {
  long long ret = 0;
  set<int>::iterator it;
  if (adj[x].size() > adj[y].size()) {
    swap(x, y);
  }
  for (it = adj[x].begin(); it != adj[x].end(); it++) {
    if (adj[y].find(*it) != adj[y].end()) {
      ret++;
    }
  }
  return ret;
}
int main() {
  long long n, m;
  scanf("%lld %lld", &n, &m);
  long long ans1 = n * (n - 1) * (n - 2) / 6, ans2 = 0;
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    ans1 -= n - 2 - cnt[x] - cnt[y];
    cnt[x]++, cnt[y]++;
  }
  printf("%lld\n", ans1 + ans2);
  return 0;
}
