#include <bits/stdc++.h>
using namespace std;
long long d[1000005];
int main() {
  int n, m, x, y;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; ++i) {
    scanf("%d %d", &x, &y);
    x--;
    y--;
    d[x]++;
    d[y]++;
  }
  long long res = 0;
  for (int i = 0; i < n; ++i) {
    res += d[i] * (d[i] - 1) + (n - 1 - d[i]) * (n - 1 - d[i] - 1) -
           d[i] * (n - 1 - d[i]);
  }
  cout << res / 6 << endl;
}
