#include<stdio.h>
#include<string.h>
int main()
{
   int t,a;
   while(scanf("%d",&t)!=EOF)
   {
       a=2;
   int n,ans=1;
   scanf("%d",&n);
  while(a>0)
    {
        if(a%2==1)
        {
            ans*=t;
        }
        t*=t;
        a/=2;
    }
   printf("%d\n",ans-n);
   }
   return 0;
}
