#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long long fin(long long a, long long b) {
  long long ans = 1;
  a %= mod;
  while (b) {
    if (b % 2 == 1) {
      ans = (ans * a) % mod;
    }
    a = (a * a) % mod;
    b = b / 2;
  }
  return ans;
}
int main() {
  long long x, k;
  cin >> x >> k;
  if (x == 0)
    cout << "0\n";
  else {
    x %= mod;
    cout << (((2 * x - 1) * fin(2, k) + mod) % mod + 1 + mod) % mod << "\n";
  }
  return 0;
}
