#include <bits/stdc++.h>
using namespace std;
void fun() {}
long long int md = 998244353;
long long int __gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return __gcd(b, a % b);
}
long long int poww(long long int a, long long int b, long long int md) {
  if (b < 0) return 0;
  if (a == 0) return 0;
  long long int res = 1;
  while (b) {
    if (b & 1) {
      res = (1ll * res * a) % md;
    }
    a = (1ll * a * a) % md;
    b >>= 1;
  }
  return res;
}
long long int poww(long long int a, long long int b) {
  if (b < 0) return 0;
  if (a == 0) return 0;
  long long int res = 1;
  while (b) {
    if (b & 1) {
      res = (1ll * res * a);
    }
    a = (1ll * a * a);
    b >>= 1;
  }
  return res;
}
void ainp(long long int arr[], long long int n) {
  for (long long int i = 1; i <= n; i++) cin >> arr[i];
}
long long int divide(long long int a, long long int b, long long int md) {
  long long int rr = a * (poww(b, md - 2, md));
  rr %= md;
  return rr;
}
const long long int size = 1e6 + 1;
long long int degree[size];
long long int n, m;
long long int vis[size];
long long int nc2(long long int num) { return num * (num - 1) / 2; }
void solve() {
  long long int summ = 0;
  for (long long int i = 1; i <= n; i++) {
    long long int alice = degree[i];
    long long int bob = n - 1 - degree[i];
    summ += 2 * nc2(alice) - alice * bob + nc2(bob) * 2;
  }
  cout << summ / 6 << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  fun();
  cin >> n >> m;
  long long int a, b;
  for (long long int i = 1; i <= m; i++) {
    cin >> a >> b;
    degree[a]++, degree[b]++;
  }
  solve();
  return 0;
}
