import java.util.*; import java.math.*; public class Solution { public static void main(String args[]){ Scanner in=new Scanner(System.in); int a=in.nextInt(); int b=in.nextInt(); BigInteger x=BigInteger.valueOf(a); BigInteger y=BigInteger.valueOf(b); x=x.pow(b); y=y.pow(a); System.out.println(x.subtract(y)); } }