#include #include #include #include #include #include #include #include #include #include #include #include template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } char ToUpper(char cX) { return toupper(cX); } char Tolower(char cX) { return tolower(cX); } const long long INF = 1LL << 60; const long long MOD = 1000000007; using namespace std; typedef unsigned long long ull; typedef long long ll; vector dp; ll power(ll x, ll n, ll p = 1000000007) { if (n == 0) { return 1; } if (n % 2 == 0) { return power(x * x % p, n / 2) % p; } else { return x * power(x, n - 1) % p; } } int main() { ll n, m; cin >> n >> m; cout << power(m, n, INF); return 0; }