#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 6;
int gr[maxn];
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d%d", &a, &b), a--, b--;
    gr[a]++;
    gr[b]++;
  }
  long long a = ((long long)n) * (n - 1) * (n - 2) / 6;
  long long b = ((long long)m) * (n - 2);
  long long d = 0;
  for (int i = 0; i < n; i++) {
    d += ((long long)gr[i]) * (gr[i] - 1) / 2;
  }
  cout << a - b + d << endl;
  return 0;
}
