import java.util.*;
public class p1 {

    public static void main(String[] args) {

        Scanner sc=new Scanner(System.in);
        long n=sc.nextLong();
        long m=sc.nextLong();
        long ans=1;

        if(n==0)
        {
            System.out.println("0");
            return;
        }


        while(m>0)
        {
            ans=(ans*n)%1000000007;
            m-=1;
        }
        System.out.println(ans);
    }

}
