#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const long long LLINF = 9223372036854775807LL;
const int ST = 100010;
const int ST1 = 1000010;
const long long MOD = 1000000007;
long long ABS(long long a) {
  if (a < 0)
    return a * (-1);
  else
    return a;
}
long long vv[ST1];
int main() {
  long long n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    vv[a]++;
    vv[b]++;
  }
  long long ans = 0;
  for (int i = 0; i <= n; i++) ans += (vv[i] * (vv[i] - 1)) / 2;
  ans += (n) * (n - 1) * (n - 2) / 6;
  ans -= (n - 2) * m;
  cout << ans;
}
