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