#include <bits/stdc++.h>
using namespace std;
int n, m;
long long a[1000010];
int main() {
  cin >> n >> m;
  int first, second;
  for (int i = 0; i < m; ++i)
    scanf("%d%d", &first, &second), a[first - 1]++, a[second - 1]++;
  long long ans = 0;
  for (int i = 0; i < n; ++i) ans += a[i] * (a[i] - 1ll);
  ans = n * (n - 1ll) * (n - 2ll) / 6ll - m * (n - 2ll) + ans / 2;
  cout << ans << endl;
  return 0;
}
