#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(0);
  cout.tie(0);
}
void online_judge() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
const int flag_max = 0x3f3f3f3f;
const long long OO = 1e6 + 9;
const double EPS = (1e-7);
int dcmp(double x, double y) { return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1; }
long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
long long d[OO];
int main() {
  fast();
  long long n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int a, b;
    cin >> a >> b;
    d[a]++;
    d[b]++;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += (d[i] * (d[i] - 1LL) - d[i] * ((long long)n - d[i] - 1LL) +
            ((long long)n - d[i] - 1LL) * ((long long)n - d[i] - 2LL));
  }
  cout << ans / 6 << '\n';
  return 0;
}
