#include #define MOD_N (1000000007) using namespace std; typedef long long ll; ll mod_pow(ll x, ll a) { if (a == 1) return x; if (a % 2) return (x * mod_pow(x, a - 1)) % MOD_N; ll t = mod_pow(x, a / 2); return (t * t) % MOD_N; } int main() { ll a, n; cin >> a >> n; cout << MOD_N << endl; cout << mod_pow(a, n) << endl; return 0; }