#include <bits/stdc++.h>
#pragma GCC optimize("03")
using namespace std;
long long x, k;
long long lgput(long long a, long long p) {
  long long rs = 1;
  while (p) {
    if (p & 1LL) rs = (rs * a) % 1000000007;
    a = (a * a) % 1000000007;
    p >>= 1LL;
  }
  return rs;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> x >> k;
  if (x == 0) return cout << 0, 0;
  long long ans = x % 1000000007;
  ans = (ans * lgput(2, k + 1)) % 1000000007;
  ans = (ans - lgput(2, k) + 1) % 1000000007;
  ans = (ans + 1000000007) % 1000000007;
  cout << ans;
  return 0;
}
