#include<stdio.h>
int main()
{
    int k,s,X,Y,Z,i,count=0;
    scanf("%d%d",&k,&s);
    for(int a=0;a<=k;a++){
        for(int b=0;b<=k;b++){
            for(int c=0;c<=k;c++){
                X=a;
                Y=b;
                Z=c;
                if((X+Y+Z)==s){
                    printf("X= %d,Y= %d,Z= %d\n",a,b,c);
                    count++;
                }
            }
        }
    }
    printf("%d",count);
}
