#include <bits/stdc++.h>
using namespace std;
template <class Type>
inline Type read(void) {
  Type x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return f * x;
}
const int mod = 1e9 + 7;
long long x, K;
inline long long mult(long long a, long long b) {
  long long ans = 0;
  for (; b; b >>= 1) {
    if (b & 1) ans = (ans + a) % mod;
    a = (a + a) % mod;
  }
  return ans;
}
inline long long power(long long a, long long b) {
  long long ans = 1;
  for (; b; b >>= 1) {
    if (b & 1) ans = mult(ans, a);
    a = mult(a, a);
  }
  return ans;
}
int main() {
  x = read<long long>();
  K = read<long long>();
  if (!x) {
    puts("0");
    return 0;
  }
  cout << (power(2, K) * (((mult(2, x) - 1) % mod + mod) % mod) + 1) % mod
       << endl;
  return 0;
}
