#include <bits/stdc++.h>
using namespace std;
inline long long ksm(long long a, long long b) {
  long long res = 1;
  for (; b; b >>= 1, a = a * a % 1000000007)
    if (b & 1) res = res * a % 1000000007;
  return res;
}
long long x, k;
signed main() {
  cin >> x >> k;
  if (x == 0) return puts("0"), 0;
  long long res =
      (ksm(2, k + 1) * (x % 1000000007)) % 1000000007 - ksm(2, k) + 1;
  if (res < 0) res += 1000000007;
  cout << res;
}
