#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 * 1000 + 100;
long long d[maxn];
int main() {
  ios::sync_with_stdio(false);
  long long n, m;
  cin >> n >> m;
  long long p = 0;
  long long Cn3 = (n * (n - 1) * (n - 2)) / 6;
  for (int i = 0; i < m; ++i) {
    int t1, t2;
    cin >> t1 >> t2;
    t1--;
    t2--;
    d[t1]++;
    d[t2]++;
  }
  for (int i = 0; i < n; ++i)
    p += (d[i] * (d[i] - 1)) / 2 + ((n - 1 - d[i]) * (n - 1 - d[i] - 1)) / 2;
  cout << (p - Cn3) / 2 << endl;
  return 0;
}
