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