#include <bits/stdc++.h>
using namespace std;
int n, m, d[1000005];
long long ans;
int inline read() {
  int res = 0;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    ;
  for (; isdigit(c); res *= 10, res += c ^ 48, c = getchar())
    ;
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  n = read();
  m = read();
  for (int i = 1; i <= m; ++i) {
    int u = read(), v = read();
    ++d[u];
    ++d[v];
  }
  for (int u = 1; u <= n; ++u) {
    int d = ::d[u];
    ans += (long long)d * (n - d - 1);
  }
  ans /= 2;
  ans = (long long)n * (n - 1) * (n - 2) / 6 - ans;
  cout << ans << '\n';
}
