#include <bits/stdc++.h>
using namespace std;
const int N = 2000000 + 10;
int a[N], b[N];
int n, m;
int main() {
  int x, y;
  scanf("%d%d", &n, &m);
  {
    for (int i = 0; i < m; i++) {
      scanf("%d%d", &x, &y);
      x--;
      y--;
      a[x]++;
      a[y]++;
    }
    for (int i = 0; i < n; i++) b[i] = n - 1 - a[i];
    long long total = 0;
    for (int i = 0; i < n; i++) total += (long long)a[i] * b[i];
    total /= 2;
    cout << (long long)n * (n - 1) / 2 * (n - 2) / 3 - total << endl;
  }
  return 0;
}
