#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e6 + 5, INF = 1e9;
int n, m, x;
int d[MAX];
void init(void) {
  scanf("%d%d", &n, &m);
  for (int i = (1), _b = (2 * m); i <= _b; i++) {
    scanf("%d", &x);
    d[x]++;
  }
}
void process(void) {
  long long res = 0;
  for (int i = (1), _b = (n); i <= _b; i++)
    res += 1ll * d[i] * (d[i] - 1) + 1ll * (n - 1 - d[i]) * (n - 2 - d[i]) -
           1ll * d[i] * (n - 1 - d[i]);
  printf("%I64d", res / 6);
}
int main(void) {
  init();
  process();
  return 0;
}
