#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000005;
const long long mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const double eps = 1e-9;
int n, m;
int degree[maxn];
int main() {
  int x, y;
  while (~scanf("%d%d", &n, &m)) {
    memset((degree), (0), sizeof(degree));
    for (int i = 1; i <= m; i++) {
      scanf("%d%d", &x, &y);
      degree[x]++;
      degree[y]++;
    }
    long long ans = (long long)n * (n - 1) * (n - 2) / 6;
    long long cnt = 0;
    for (int i = 1; i <= n; i++) {
      cnt += (long long)degree[i] * (n - 1 - degree[i]);
    }
    ans -= cnt / 2;
    printf("%I64d\n", ans);
  }
  return 0;
}
