#include <bits/stdc++.h>
using namespace std;
const int MN = 100 * 100 * 100 + 100;
int n, m, d[MN];
vector<int> g[MN];
bool mark[MN];
long long ans;
void dfs(int v, int depth) {
  mark[v] = true;
  d[v] = depth;
  for (int i = 0; i < g[v].size(); i++) {
    if (!mark[g[v][i]])
      dfs(g[v][i], depth + 1);
    else if (d[g[v][i]] == d[v] - 2)
      ans += 3;
  }
}
int main() {
  ios::sync_with_stdio(false);
  char ch;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  ans = ((long long)n * (n - 1) * (n - 2)) / 6 - (long long)m * (n - 2);
  for (int i = 0; i < n; i++) {
    long long s = g[i].size();
    long long x = (long long)((long long)s * (s - 1)) / 2;
    ans += x;
  }
  cout << ans;
  return 0;
}
