#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-9;
const long double pi = acos(-1.0);
const int inf = 2 * 1e+9;
long long gcd(long long a, long long b) { return (b == 0) ? a : gcd(b, a % b); }
int xabs(int a) { return a >= 0 ? a : -a; }
int sign(int a) { return (a < 0) ? -1 : 1; }
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  vector<int> g(n);
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    a--;
    b--;
    g[a]++;
    g[b]++;
  }
  long long res = 0;
  for (int i = 0; i < n; i++) {
    long long good = g[i];
    long long bad = n - 1 - good;
    res += (bad - 1) * bad + (good - 1) * good;
    res -= bad * good;
  }
  cout << res / 6 << endl;
  return 0;
}
