#include<bits/stdc++.h> using namespace std; const int MOD=(int)1e9+7; typedef long long ll; ll poww(ll a, ll b) { ll ans = 1, base = a%MOD; while(b != 0) { if(b&1 != 0) ans = (ans*base)%MOD; base = (base*base)%MOD; b >>= 1; } return ans%MOD; } int main() { ll x,k; scanf("%lld%lld",&x,&k); if(x==0) { printf("0 ");//注意样例中的特殊范围,看样例中是否包含0!! return 0; } x%=MOD; printf("%lld ",(x*poww(2,k+1)%MOD-poww(2,k)%MOD+MOD+1)%MOD);//避免减出负数 }