#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << '\n';
  err(++it, args...);
}
long long mod(long long n) {
  return (n % 1000000007 + 1000000007) % 1000000007;
}
long long power(long long x, long long y) {
  long long res = 1;
  x = mod(x);
  while (y > 0) {
    if (y & 1) res = mod(res * x);
    y = y >> 1;
    x = mod(x * x);
  }
  return res;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long x, k;
  cin >> x >> k;
  if (x == 0) {
    cout << 0 << '\n';
    return 0;
  }
  if (k == 0) {
    cout << mod(2 * x) << '\n';
    return 0;
  }
  long long ans = mod(mod(power(2, k) * mod(2 * x - 1)) + 1);
  cout << ans << '\n';
  return 0;
}
