#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long x, k;
long long ans;
long long fast_pow(long long t, long long q) {
  t %= MOD;
  if (q == 1) return t;
  if (q == 0) return 1LL;
  long long res = fast_pow((t * t) % MOD, q / 2);
  if (q & 1) res = (res * t) % MOD;
  return res;
}
long long low, high, branches;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cin >> x >> k;
  if (k == 0) {
    cout << (x * 2LL) % MOD << endl;
    return 0;
  }
  if (x == 0) {
    cout << 0 << endl;
    return 0;
  }
  x %= MOD;
  high = (x * fast_pow(2LL, k)) % MOD;
  branches = fast_pow(2LL, k);
  low = ((high - (branches - 1LL)) + MOD) % MOD;
  ans = (low + high) % MOD;
  cout << ans << endl;
  return 0;
}
