#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000 * 1000 + 10;
long long d[MAXN];
int main() {
  ios::sync_with_stdio(false);
  long long n, m;
  long long num;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    d[x]++;
    d[y]++;
  }
  num = (n * (n - 1) * (n - 2)) / 3;
  for (int i = 0; i < n; i++) {
    num -= (d[i] * (n - 1 - d[i]));
  }
  cout << num / 2 << endl;
  return 0;
}
