#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long x, k, ans;
long long lgput(long long b, long long e) {
  long long r = 1;
  if (e == 1) return b;
  if (e == 0) return 1;
  long long k = lgput(b, e / 2);
  if (e % 2 == 1)
    r = b * k * k;
  else
    r = k * k;
  r %= mod;
  return r;
}
int main() {
  cin >> x >> k;
  if (x == 0) {
    cout << 0;
    return 0;
  }
  if (k == 0) {
    cout << (x * 2) % mod;
    return 0;
  }
  ans = (x % mod) * lgput(2, k + 1);
  ans %= mod;
  ans = ans + mod - lgput(2, k) + 1;
  ans %= mod;
  cout << ans;
  return 0;
}
