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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.*;
import java.util.*;
public class C{
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskE solver = new TaskE();
        solver.solve(1, in, out);
        out.flush();out.close();
    }
        static class TaskE {
            int n, m;
            // int ja[][];
            int from[], to[], c[];
           public void solve(int testNumber, InputReader in, PrintWriter out) {
            n = in.nextInt(); m = in.nextInt();
            // ja = new int[n + 1][]; 
            from = new int[m + 1]; to = new int[m + 1]; 
            c = new int[n + 1];
            long add = 0;
            for(int i = 1; i <= m; i++){
                int a = in.nextInt() , b =in.nextInt();
                from[i] = a; to[i] = b;
                c[a]++; c[b]++;
            }
            // for(int i = 1; i <= n; i++){
            //     ja[i] = new int[c[i]]; c[i] = 0;
            // }
            // for(int i = 1; i <= m; i++){
            //     ja[from[i]][c[from[i]]++] = to[i];
            //     ja[to[i]][c[to[i]]++] = from[i];
            // }
            // for(int i = 1; i <= n; i++){
            //     ja[i] = radixSort(ja[i]);
            // }
            // long x = 0 , y = 0;
            long sum = 0;
            for(int i = 1; i <= m; i++){
                int a = from[i], b = to[i];
                sum += c[a] + c[b] - 2;
                // int pa = 0, pb = 0, ca = ja[a].length, cb = ja[b].length;
                // int cs = 0;
                // while(pa < ca && pb < cb){
                //     if(ja[a][pa] < ja[b][pb]){
                //         ++pa;
                //     }else if(ja[a][pa] > ja[b][pb]){
                //         ++pb;
                //     }else{
                //         cs++; ++pa; ++pb;
                //     }
                // }   
                // ca -= cs + 1; cb -= cs + 1;
                // // System.out.println(ca + " " + cb + " " + cs);
                // x += ca + cb; y += cs;
            }
            // y /= 3; x /= 2;
            long ans = (long)n * (n - 1) * (n - 2) / 6;
            ans -= (long)m * (n - 2);
            // ans += 3 * y  + x;
            ans += sum / 2;
            out.print(ans);
          }
       int[] radixSort(int[] f){ return radixSort(f, f.length); }
       int[] radixSort(int[] f, int n)
       {
           int[] to = new int[n];
           {
               int[] b = new int[65537];
               for(int i = 0;i < n;i++)b[1+(f[i]&0xffff)]++;
               for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
               for(int i = 0;i < n;i++)to[b[f[i]&0xffff]++] = f[i];
               int[] d = f; f = to;to = d;
           }
           {
               int[] b = new int[65537];
               for(int i = 0;i < n;i++)b[1+(f[i]>>>16)]++;
               for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
               for(int i = 0;i < n;i++)to[b[f[i]>>>16]++] = f[i];
               int[] d = f; f = to;to = d;
           }
           return f;
       }
    }
    static class InputReader {
        BufferedReader br;
        StringTokenizer st;
        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}