#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-8;
vector<string> parse(string s, string c) {
  int len = c.length(), p = -len, np;
  vector<string> ans;
  do {
    np = s.find(c, p + len);
    ans.push_back(s.substr(p + len, np - p - len));
    p = np;
  } while (p != string::npos);
  return ans;
}
int main() {
  long long deg[1000009];
  memset(deg, 0, sizeof(deg));
  int n, m, a, b;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &a, &b);
    deg[a]++;
    deg[b]++;
  }
  long long was = 0;
  long long n1 = n;
  for (int i = 1; i <= n; i++) was += deg[i] * (n1 - 1 - deg[i]);
  was = was / 2;
  long long tt = n1 * (n1 - 1) * (n1 - 2) / 6;
  cout << tt - was << endl;
  return 0;
}
