#include <bits/stdc++.h>
using namespace std;
bool debugging = false;
int main() {
  long long int n, m;
  cin >> n >> m;
  if (debugging) printf("Zz\n");
  int deg[n + 1];
  if (debugging) printf("Zz\n");
  for (int i = 0; i <= n; i++) {
    deg[i] = 0;
  }
  int count = 0;
  if (debugging) printf("Zz\n");
  long long int destroy = 0;
  if (debugging) printf("Zz\n");
  long long int deg1, deg2;
  if (debugging) printf("Zz\n");
  for (int i = 0; i < m; i++) {
    int a;
    int b;
    scanf("%d%d", &a, &b);
    destroy += n - 2 - deg[a] - deg[b];
    deg[a]++;
    deg[b]++;
  }
  long long int total = 1;
  if (debugging) printf("Zz\n");
  total *= n;
  if (debugging) printf("Zz\n");
  total *= (n - 1);
  if (debugging) printf("Zz\n");
  total *= (n - 2);
  if (debugging) printf("Zz\n");
  total /= 6;
  if (debugging) printf("Zz\n");
  cout << total - destroy << endl;
}
