#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int in[N], n, m;
int main() {
  scanf("%d%d", &n, &m);
  long long ans = 0, t = 0;
  for (int i = 0; i < m; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    in[x]++;
    in[y]++;
  }
  ans = 1ll * n * (n - 1) * (n - 2) / 6;
  for (int i = 1; i <= n; ++i) t += 1ll * in[i] * (n - 1 - in[i]);
  cout << ans - t / 2;
  return 0;
}
