#include <bits/stdc++.h>
using namespace std;
int st[1000011];
int siz[1000011];
vector<int> road[1000011];
int main() {
  long long int n, m;
  while (cin >> n >> m) {
    for (int xx = 0; xx <= n; xx++) st[xx] = xx;
    ;
    for (int i = 1; i <= n; i++) siz[i] = 1;
    int cnt = 0;
    long long res = n * (n - 1) * (n - 2) / 6;
    long long res2 = 0;
    for (int i = 0; i < m; i++) {
      int a, b;
      scanf("%d%d", &a, &b);
      road[a].push_back(b);
      road[b].push_back(a);
      res -= n - road[a].size() - road[b].size();
    }
    cout << res + res2 << endl;
  }
  return 0;
}
