#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e6 + 6;
long long g[MAX];
long long comb(long long a) { return a * (a - 1) / 2; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m, a, b;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    g[a]++, g[b]++;
  }
  long long sum = 0;
  for (int i = 1; i < n + 1; i++) {
    long long aum =
        2 * comb(g[i]) + 2 * comb(n - 1 - g[i]) - g[i] * (n - 1 - g[i]);
    sum += aum;
  }
  cout << sum / 6;
}
