#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long Pow(long long power) {
  if (power == 0) return 1;
  if (power == 1) return 2;
  if (power % 2 == 0)
    return (Pow(power / 2) % mod * Pow(power / 2) % mod) % mod;
  else
    return 2 * Pow(power - 1) % mod;
}
int main() {
  long long x, k;
  cin >> x >> k;
  if (x == 0) {
    cout << 0;
    return 0;
  }
  long long ans = 2 * x - 1;
  ans %= mod;
  long long answer = ((Pow(k) * ans) % mod + 1) % mod;
  cout << answer;
}
