import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC051_B solver = new ABC051_B();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC051_B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int k = in.nextInt();
            int s = in.nextInt();

            int counter = 0;
            for (int i = 0; i <= k; ++i) {
                for (int j = 0; j <= k; ++j) {
                    int l = s - (i + j);
                    if (l >= 0 && l <= k) ++counter;
                    else continue;
                    ;
                }
            }

            out.println(counter);
        }

    }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC051_B solver = new ABC051_B();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC051_B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int k = in.nextInt();
            int s = in.nextInt();

            int counter = 0;
            for (int i = 0; i <= k; ++i) {
                for (int j = 0; j <= k; ++j) {
                    int l = s - (i + j);
                    if (l >= 0 && l <= k) ++counter;
                    else continue;
                    ;
                }
            }

            out.println(counter);
        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC051_B solver = new ABC051_B();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC051_B solver = new ABC051_B();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner in = new Scanner(inputStream); in new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) ABC051_B solver = new ABC051_B(); solver new ABC051_B() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class ABC051_B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int k = in.nextInt();
            int s = in.nextInt();

            int counter = 0;
            for (int i = 0; i <= k; ++i) {
                for (int j = 0; j <= k; ++j) {
                    int l = s - (i + j);
                    if (l >= 0 && l <= k) ++counter;
                    else continue;
                    ;
                }
            }

            out.println(counter);
        }

    } ABC051_B public void solve(int testNumber, Scanner in, PrintWriter out) {
            int k = in.nextInt();
            int s = in.nextInt();

            int counter = 0;
            for (int i = 0; i <= k; ++i) {
                for (int j = 0; j <= k; ++j) {
                    int l = s - (i + j);
                    if (l >= 0 && l <= k) ++counter;
                    else continue;
                    ;
                }
            }

            out.println(counter);
        } solve {
            int k = in.nextInt();
            int s = in.nextInt();

            int counter = 0;
            for (int i = 0; i <= k; ++i) {
                for (int j = 0; j <= k; ++j) {
                    int l = s - (i + j);
                    if (l >= 0 && l <= k) ++counter;
                    else continue;
                    ;
                }
            }

            out.println(counter);
        } int k = in.nextInt(); k in.nextInt() in.nextInt in int s = in.nextInt(); s in.nextInt() in.nextInt in int counter = 0; counter 0 for (int i = 0; i <= k; ++i) {
                for (int j = 0; j <= k; ++j) {
                    int l = s - (i + j);
                    if (l >= 0 && l <= k) ++counter;
                    else continue;
                    ;
                }
            } int i = 0; int i = 0; i 0 i <= k i k ++i ++i i {
                for (int j = 0; j <= k; ++j) {
                    int l = s - (i + j);
                    if (l >= 0 && l <= k) ++counter;
                    else continue;
                    ;
                }
            } {
                for (int j = 0; j <= k; ++j) {
                    int l = s - (i + j);
                    if (l >= 0 && l <= k) ++counter;
                    else continue;
                    ;
                }
            } for (int j = 0; j <= k; ++j) {
                    int l = s - (i + j);
                    if (l >= 0 && l <= k) ++counter;
                    else continue;
                    ;
                } int j = 0; int j = 0; j 0 j <= k j k ++j ++j j {
                    int l = s - (i + j);
                    if (l >= 0 && l <= k) ++counter;
                    else continue;
                    ;
                } {
                    int l = s - (i + j);
                    if (l >= 0 && l <= k) ++counter;
                    else continue;
                    ;
                } int l = s - (i + j); l s - (i + j) s (i + j) i j if (l >= 0 && l <= k) ++counter;
                    else continue; l >= 0 && l <= k l >= 0 l 0 l <= k l k ++counter counter continue; out.println(counter) out.println out counter int testNumber testNumber Scanner in in PrintWriter out out public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC051_B solver = new ABC051_B();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC051_B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int k = in.nextInt();
            int s = in.nextInt();

            int counter = 0;
            for (int i = 0; i <= k; ++i) {
                for (int j = 0; j <= k; ++j) {
                    int l = s - (i + j);
                    if (l >= 0 && l <= k) ++counter;
                    else continue;
                    ;
                }
            }

            out.println(counter);
        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC051_B solver = new ABC051_B();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC051_B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int k = in.nextInt();
            int s = in.nextInt();

            int counter = 0;
            for (int i = 0; i <= k; ++i) {
                for (int j = 0; j <= k; ++j) {
                    int l = s - (i + j);
                    if (l >= 0 && l <= k) ++counter;
                    else continue;
                    ;
                }
            }

            out.println(counter);
        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC051_B solver = new ABC051_B();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC051_B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int k = in.nextInt();
            int s = in.nextInt();

            int counter = 0;
            for (int i = 0; i <= k; ++i) {
                for (int j = 0; j <= k; ++j) {
                    int l = s - (i + j);
                    if (l >= 0 && l <= k) ++counter;
                    else continue;
                    ;
                }
            }

            out.println(counter);
        }

    }
}

