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3 9
9 10
 10 10
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
 3 0
 6 6
1 2
2 3
3 1
4 5
5 6
6 4
 10 0
 9 15
1 2
2 3
3 1
1 4
4 5
5 1
1 6
6 7
7 1
1 8
8 9
9 1
2 9
7 4
2 8
 4 0
 1 0

1
 0
 43
 0
 8
 0
 84
 82
 63
 166666166667000000
 21
 30
 292
 64
 36
 0
 84
 284
 1
 37
 1
 4
 59
 50
 1
 2
 120
 28
 4
 0

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.List;
import java.util.Set;

public class ProblemC {
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(System.out);
		long time = System.currentTimeMillis();
		int n = in.readInt();
		int m = in.readInt();
		int[] deg = new int[n];
		for (int i = 0 ; i < m ; i++) {
			int a = in.readInt()-1;
			int b = in.readInt()-1;
			deg[a]++;
			deg[b]++;
		}
		
		long ans = 0;
		for (int i = 0 ; i < n ; i++) {
			ans += (n - 1 - deg[i]) * deg[i];
		}
		ans /= 2;
		out.println(1L * n * (n-1) * (n-2) / 6 - ans);
		out.flush();
	}
	
    static void pr(int n, int m) {
    	System.out.println(n + " " + m);
    	Set<Integer>[] done = new Set[n+1];
    	for (int i = 0 ; i < n+1 ; i++) {
    		done[i] = new HashSet<Integer>();
    	}
    	for (int i = 0 ; i < m ; i++) {
    		int a = (int)(Math.random() * n) + 1;
    		int b = (int)(Math.random() * n) + 1;
    		if (a == b) {
    			--i;
    			continue;
    		}
    		if (done[a].contains(b)) {
    			--i;
    			continue;
    		}
    		System.out.println(a + " " + b);
    		done[a].add(b);
    		done[b].add(a);
    	}
    }

	public static void debug(Object... o) {
		System.err.println(Arrays.deepToString(o));
	}
	
}

class InputReader {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

    public InputReader(InputStream stream) {
          this.stream = stream;
    }

    public int read() {
          if (numChars == -1)
                throw new InputMismatchException();
          if (curChar >= numChars) {
                curChar = 0;
                try {
                      numChars = stream.read(buf);
                } catch (IOException e) {
                      throw new InputMismatchException();
                }
                if (numChars <= 0)
                      return -1;
          }
          return buf[curChar++];
    }

    public int readInt() {
          int c = read();
          while (isSpaceChar(c))
                c = read();
          int sgn = 1;
          if (c == '-') {
                sgn = -1;
                c = read();
          }
          int res = 0;
          do {
                if (c < '0' || c > '9')
                      throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
          } while (!isSpaceChar(c));
          return res * sgn;
    }

    public boolean isSpaceChar(int c) {
          if (filter != null)
                return filter.isSpaceChar(c);
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public interface SpaceCharFilter {
          public boolean isSpaceChar(int ch);
    }
}

