#include <bits/stdc++.h>
using namespace std;
vector<long long> a;
long long power(long long x, long long y) {
  long long res = 1;
  x = x % 1000000007;
  while (y > 0) {
    if (y & 1) res = (res * x) % 1000000007;
    y = y >> 1;
    x = (x * x) % 1000000007;
  }
  return res;
}
int main() {
  long long x, k, ans = 0;
  cin >> x >> k;
  if (x == 0) {
    cout << 0 << endl;
    return 0;
  }
  if (k == 0) {
    x = x * 2;
    x = x % 1000000007;
    cout << x;
    return 0;
  }
  ans = (power(2, k)) % 1000000007;
  long long sum = (power(2, k) - 1);
  sum = sum % 1000000007;
  if (sum < 0) sum += 1000000007;
  if (k == 1) sum = 1;
  ans *= 2;
  ans = ans % 1000000007;
  ans = (ans * (x % 1000000007)) % 1000000007;
  ans -= sum;
  if (ans < 0) ans += 1000000007;
  cout << ans << endl;
  return 0;
}
