import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        int k = scan.nextInt();
        int s = scan.nextInt();
        //System.out.println("k = " + k);
        //System.out.println("s = " + s);
        if(k >= s){
            System.out.println((s + 2) * (s + 1) / 2);
        }else{
            int ans = 0;
            for(int x = 0; x <= k; x++){
                for(int y = 0; y <= k; y++){
                    int z = s - x - y;
                    if(z >= 0 && z <= k){
                        ans++;
                    }
                }
            }
            System.out.println(ans);
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        int k = scan.nextInt();
        int s = scan.nextInt();
        //System.out.println("k = " + k);
        //System.out.println("s = " + s);
        if(k >= s){
            System.out.println((s + 2) * (s + 1) / 2);
        }else{
            int ans = 0;
            for(int x = 0; x <= k; x++){
                for(int y = 0; y <= k; y++){
                    int z = s - x - y;
                    if(z >= 0 && z <= k){
                        ans++;
                    }
                }
            }
            System.out.println(ans);
        }
    }
} Main public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        int k = scan.nextInt();
        int s = scan.nextInt();
        //System.out.println("k = " + k);
        //System.out.println("s = " + s);
        if(k >= s){
            System.out.println((s + 2) * (s + 1) / 2);
        }else{
            int ans = 0;
            for(int x = 0; x <= k; x++){
                for(int y = 0; y <= k; y++){
                    int z = s - x - y;
                    if(z >= 0 && z <= k){
                        ans++;
                    }
                }
            }
            System.out.println(ans);
        }
    } main {
        Scanner scan = new Scanner(System.in);
        int k = scan.nextInt();
        int s = scan.nextInt();
        //System.out.println("k = " + k);
        //System.out.println("s = " + s);
        if(k >= s){
            System.out.println((s + 2) * (s + 1) / 2);
        }else{
            int ans = 0;
            for(int x = 0; x <= k; x++){
                for(int y = 0; y <= k; y++){
                    int z = s - x - y;
                    if(z >= 0 && z <= k){
                        ans++;
                    }
                }
            }
            System.out.println(ans);
        }
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int k = scan.nextInt(); k scan.nextInt() scan.nextInt scan int s = scan.nextInt(); s scan.nextInt() scan.nextInt scan if(k >= s){
            System.out.println((s + 2) * (s + 1) / 2);
        }else{
            int ans = 0;
            for(int x = 0; x <= k; x++){
                for(int y = 0; y <= k; y++){
                    int z = s - x - y;
                    if(z >= 0 && z <= k){
                        ans++;
                    }
                }
            }
            System.out.println(ans);
        } k >= s k s {
            System.out.println((s + 2) * (s + 1) / 2);
        } System.out.println((s + 2) * (s + 1) / 2) System.out.println System.out System System.out (s + 2) * (s + 1) / 2 (s + 2) * (s + 1) (s + 2) s 2 (s + 1) s 1 2 {
            int ans = 0;
            for(int x = 0; x <= k; x++){
                for(int y = 0; y <= k; y++){
                    int z = s - x - y;
                    if(z >= 0 && z <= k){
                        ans++;
                    }
                }
            }
            System.out.println(ans);
        } int ans = 0; ans 0 for(int x = 0; x <= k; x++){
                for(int y = 0; y <= k; y++){
                    int z = s - x - y;
                    if(z >= 0 && z <= k){
                        ans++;
                    }
                }
            } 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(z >= 0 && z <= k){
                        ans++;
                    }
                }
            } {
                for(int y = 0; y <= k; y++){
                    int z = s - x - y;
                    if(z >= 0 && z <= k){
                        ans++;
                    }
                }
            } for(int y = 0; y <= k; y++){
                    int z = s - x - y;
                    if(z >= 0 && z <= k){
                        ans++;
                    }
                } int y = 0; int y = 0; y 0 y <= k y k y++ y++ y {
                    int z = s - x - y;
                    if(z >= 0 && z <= k){
                        ans++;
                    }
                } {
                    int z = s - x - y;
                    if(z >= 0 && z <= k){
                        ans++;
                    }
                } int z = s - x - y; z s - x - y s - x - y s x y if(z >= 0 && z <= k){
                        ans++;
                    } z >= 0 && z <= k z >= 0 z 0 z <= k z k {
                        ans++;
                    } ans++ ans System.out.println(ans) System.out.println System.out System System.out ans String args[] args public class Main {
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        int k = scan.nextInt();
        int s = scan.nextInt();
        //System.out.println("k = " + k);
        //System.out.println("s = " + s);
        if(k >= s){
            System.out.println((s + 2) * (s + 1) / 2);
        }else{
            int ans = 0;
            for(int x = 0; x <= k; x++){
                for(int y = 0; y <= k; y++){
                    int z = s - x - y;
                    if(z >= 0 && z <= k){
                        ans++;
                    }
                }
            }
            System.out.println(ans);
        }
    }
} public class Main {
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        int k = scan.nextInt();
        int s = scan.nextInt();
        //System.out.println("k = " + k);
        //System.out.println("s = " + s);
        if(k >= s){
            System.out.println((s + 2) * (s + 1) / 2);
        }else{
            int ans = 0;
            for(int x = 0; x <= k; x++){
                for(int y = 0; y <= k; y++){
                    int z = s - x - y;
                    if(z >= 0 && z <= k){
                        ans++;
                    }
                }
            }
            System.out.println(ans);
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        int k = scan.nextInt();
        int s = scan.nextInt();
        //System.out.println("k = " + k);
        //System.out.println("s = " + s);
        if(k >= s){
            System.out.println((s + 2) * (s + 1) / 2);
        }else{
            int ans = 0;
            for(int x = 0; x <= k; x++){
                for(int y = 0; y <= k; y++){
                    int z = s - x - y;
                    if(z >= 0 && z <= k){
                        ans++;
                    }
                }
            }
            System.out.println(ans);
        }
    }
}