#include<iostream>
#include<math.h>
using namespace std;
 
#define ll long long
const int MOD = 1e9+7;
 
ll power(ll a, ll b)
{
    if(b == 1)
        return a%MOD;
    return ((power(a, b-1)%MOD)*(a%MOD))%MOD;
}
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    ll a, b;
    cin >> a >> b;
    cout << power(a, b);
}