#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long MAX = 1000000000000000000LL;
long long fexp(long long b, long long e) {
  if (e == 0) return 1;
  if (e == 1) return b;
  if (e & 1) return (b * fexp(b, e - 1LL)) % MOD;
  long long a = fexp(b, e >> 1LL);
  return (a * a) % MOD;
}
long long slowsolve(long long x, long long k) {
  if (k == 0)
    return x * 2LL;
  else
    return (slowsolve(x * 2LL, k - 1LL) + slowsolve(x * 2LL - 1LL, k - 1LL)) /
           2LL;
}
int main() {
  long long x, k;
  cin >> x >> k;
  if (x == 0LL) {
    cout << 0LL << endl;
    return 0;
  }
  if (k == 0) {
    cout << (x * 2LL) % MOD << endl;
    return 0;
  }
  long long val = fexp(2LL, k - 1LL);
  x %= MOD;
  long long ans = x * 2LL - 1LL;
  ans *= val;
  ans %= MOD;
  ans = ans * 2LL + 1LL;
  ans %= MOD;
  cout << (ans + MOD) % MOD << endl;
  return 0;
}
