#include <bits/stdc++.h>
using namespace std;
long long dev[1111111];
long long res[1111111];
long long n, m;
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    x--;
    y--;
    dev[x]++;
    dev[y]++;
  }
  long long answer = 0;
  for (int i = 0; i < n; i++) {
    long long d = dev[i];
    answer += d * (d - 1);
    answer -= d * (n - d - 1);
    answer += (n - d - 1) * (n - d - 2);
  }
  answer /= 6;
  printf("%I64d\n", answer);
  return 0;
}
