import java.io.*;
import java.util.*;
 
public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;
 
    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);
 
    private void solve(Scanner sc) {
        int K = sc.nextInt();
        int S = sc.nextInt();
 
        int cnt = 0;
        for (int x = 0; x <= K; ++x) {
            for (int y = 0; y <= K; ++y) {
                int z = S - x - y;
                if (0 <= z && z <= K) {
                    ++cnt;
                }
            }
        }
        _out.println(cnt);
    }
    private long C(long n, long r) {
        long res = 1;
        for (long i = n; i > n - r; --i) {
            res *= i;
        }
        for (long i = r; i > 1; --i) {
            res /= i;
        }
        return res;
    }
    private long P(long n, long r) {
        long res = 1;
        for (long i = n; i > n - r; --i) {
            res *= i;
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();
 
        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();
 
        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;
 
    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);
 
    private void solve(Scanner sc) {
        int K = sc.nextInt();
        int S = sc.nextInt();
 
        int cnt = 0;
        for (int x = 0; x <= K; ++x) {
            for (int y = 0; y <= K; ++y) {
                int z = S - x - y;
                if (0 <= z && z <= K) {
                    ++cnt;
                }
            }
        }
        _out.println(cnt);
    }
    private long C(long n, long r) {
        long res = 1;
        for (long i = n; i > n - r; --i) {
            res *= i;
        }
        for (long i = r; i > 1; --i) {
            res /= i;
        }
        return res;
    }
    private long P(long n, long r) {
        long res = 1;
        for (long i = n; i > n - r; --i) {
            res *= i;
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();
 
        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();
 
        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
} Main private static boolean debug = false; debug false private static boolean elapsed = false; elapsed false private static PrintWriter _out = new PrintWriter(System.out); _out new PrintWriter(System.out) private static PrintWriter _err = new PrintWriter(System.err); _err new PrintWriter(System.err) private void solve(Scanner sc) {
        int K = sc.nextInt();
        int S = sc.nextInt();
 
        int cnt = 0;
        for (int x = 0; x <= K; ++x) {
            for (int y = 0; y <= K; ++y) {
                int z = S - x - y;
                if (0 <= z && z <= K) {
                    ++cnt;
                }
            }
        }
        _out.println(cnt);
    } solve {
        int K = sc.nextInt();
        int S = sc.nextInt();
 
        int cnt = 0;
        for (int x = 0; x <= K; ++x) {
            for (int y = 0; y <= K; ++y) {
                int z = S - x - y;
                if (0 <= z && z <= K) {
                    ++cnt;
                }
            }
        }
        _out.println(cnt);
    } int K = sc.nextInt(); K sc.nextInt() sc.nextInt sc int S = sc.nextInt(); S sc.nextInt() sc.nextInt sc int cnt = 0; cnt 0 for (int x = 0; x <= K; ++x) {
            for (int y = 0; y <= K; ++y) {
                int z = S - x - y;
                if (0 <= z && z <= K) {
                    ++cnt;
                }
            }
        } int x = 0; int x = 0; x 0 x <= K x K ++x ++x x {
            for (int y = 0; y <= K; ++y) {
                int z = S - x - y;
                if (0 <= z && z <= K) {
                    ++cnt;
                }
            }
        } {
            for (int y = 0; y <= K; ++y) {
                int z = S - x - y;
                if (0 <= z && z <= K) {
                    ++cnt;
                }
            }
        } for (int y = 0; y <= K; ++y) {
                int z = S - x - y;
                if (0 <= z && z <= K) {
                    ++cnt;
                }
            } int y = 0; int y = 0; y 0 y <= K y K ++y ++y y {
                int z = S - x - y;
                if (0 <= z && z <= K) {
                    ++cnt;
                }
            } {
                int z = S - x - y;
                if (0 <= z && z <= K) {
                    ++cnt;
                }
            } int z = S - x - y; z S - x - y S - x - y S x y if (0 <= z && z <= K) {
                    ++cnt;
                } 0 <= z && z <= K 0 <= z 0 z z <= K z K {
                    ++cnt;
                } ++cnt cnt _out.println(cnt) _out.println _out cnt Scanner sc sc private long C(long n, long r) {
        long res = 1;
        for (long i = n; i > n - r; --i) {
            res *= i;
        }
        for (long i = r; i > 1; --i) {
            res /= i;
        }
        return res;
    } C {
        long res = 1;
        for (long i = n; i > n - r; --i) {
            res *= i;
        }
        for (long i = r; i > 1; --i) {
            res /= i;
        }
        return res;
    } long res = 1; res 1 for (long i = n; i > n - r; --i) {
            res *= i;
        } long i = n; long i = n; i n i > n - r i n - r n r --i --i i {
            res *= i;
        } {
            res *= i;
        } res *= i res i for (long i = r; i > 1; --i) {
            res /= i;
        } long i = r; long i = r; i r i > 1 i 1 --i --i i {
            res /= i;
        } {
            res /= i;
        } res /= i res i return res; res long n n long r r private long P(long n, long r) {
        long res = 1;
        for (long i = n; i > n - r; --i) {
            res *= i;
        }
        return res;
    } P {
        long res = 1;
        for (long i = n; i > n - r; --i) {
            res *= i;
        }
        return res;
    } long res = 1; res 1 for (long i = n; i > n - r; --i) {
            res *= i;
        } long i = n; long i = n; i n i > n - r i n - r n r --i --i i {
            res *= i;
        } {
            res *= i;
        } res *= i res i return res; res long n n long r r /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();
 
        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();
 
        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    } main {
        long S = System.currentTimeMillis();
 
        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();
 
        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    } long S = System.currentTimeMillis(); S System.currentTimeMillis() System.currentTimeMillis System Scanner sc = new Scanner(System.in); sc new Scanner(System.in) new Main().solve(sc) new Main().solve new Main() sc _out.flush() _out.flush _out long G = System.currentTimeMillis(); G System.currentTimeMillis() System.currentTimeMillis System if (elapsed) {
            _err.println((G - S) + "ms");
        } elapsed {
            _err.println((G - S) + "ms");
        } _err.println((G - S) + "ms") _err.println _err (G - S) + "ms" (G - S) G S "ms" _err.flush() _err.flush _err String[] args args public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;
 
    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);
 
    private void solve(Scanner sc) {
        int K = sc.nextInt();
        int S = sc.nextInt();
 
        int cnt = 0;
        for (int x = 0; x <= K; ++x) {
            for (int y = 0; y <= K; ++y) {
                int z = S - x - y;
                if (0 <= z && z <= K) {
                    ++cnt;
                }
            }
        }
        _out.println(cnt);
    }
    private long C(long n, long r) {
        long res = 1;
        for (long i = n; i > n - r; --i) {
            res *= i;
        }
        for (long i = r; i > 1; --i) {
            res /= i;
        }
        return res;
    }
    private long P(long n, long r) {
        long res = 1;
        for (long i = n; i > n - r; --i) {
            res *= i;
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();
 
        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();
 
        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
} public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;
 
    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);
 
    private void solve(Scanner sc) {
        int K = sc.nextInt();
        int S = sc.nextInt();
 
        int cnt = 0;
        for (int x = 0; x <= K; ++x) {
            for (int y = 0; y <= K; ++y) {
                int z = S - x - y;
                if (0 <= z && z <= K) {
                    ++cnt;
                }
            }
        }
        _out.println(cnt);
    }
    private long C(long n, long r) {
        long res = 1;
        for (long i = n; i > n - r; --i) {
            res *= i;
        }
        for (long i = r; i > 1; --i) {
            res /= i;
        }
        return res;
    }
    private long P(long n, long r) {
        long res = 1;
        for (long i = n; i > n - r; --i) {
            res *= i;
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();
 
        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();
 
        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
} Main
import java.io.*;
import java.util.*;
 
public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;
 
    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);
 
    private void solve(Scanner sc) {
        int K = sc.nextInt();
        int S = sc.nextInt();
 
        int cnt = 0;
        for (int x = 0; x <= K; ++x) {
            for (int y = 0; y <= K; ++y) {
                int z = S - x - y;
                if (0 <= z && z <= K) {
                    ++cnt;
                }
            }
        }
        _out.println(cnt);
    }
    private long C(long n, long r) {
        long res = 1;
        for (long i = n; i > n - r; --i) {
            res *= i;
        }
        for (long i = r; i > 1; --i) {
            res /= i;
        }
        return res;
    }
    private long P(long n, long r) {
        long res = 1;
        for (long i = n; i > n - r; --i) {
            res *= i;
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();
 
        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();
 
        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}