#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
const int mod = (int)1e9 + 7;
const int N = 2e5 + 10;
const long long inf = -1e9;
struct event {
  long long a, b, c, d;
};
struct myComp {
  constexpr bool operator()(pair<int, int> const& a,
                            pair<int, int> const& b) const noexcept {
    return a.first < b.first;
  }
};
long long modd(long long x) { return (x % mod + mod) % mod; }
long long f(long long a, long long power) {
  if (power == 0) return 1;
  if (power % 2 == 1) return a * f(a, power - 1) % mod;
  long long res = f(a, power / 2);
  res = res * res % mod;
  return res;
}
void solve() {
  long long x, k;
  cin >> x >> k;
  if (x == 0) {
    cout << 0 << "\n";
    return;
  }
  if (k == 0) {
    cout << modd(2 * x) << '\n';
  } else {
    long long z = modd(2 * x - 1);
    cout << modd(2 * z * f(2, k - 1) + 1) << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
