#include <bits/stdc++.h>
using namespace std;
long long pot(int a, long long b) {
  if (b == 0) return 1;
  long long x = pot(a, b / 2);
  x = (x * x) % 1000000007LL;
  if (b % 2 == 1) x = (x * a) % 1000000007LL;
  return x;
}
long long inv(long long x) { return pot(x, 1000000007LL - 2); }
int main() {
  long long x, k;
  cin >> x >> k;
  if (x == 0) {
    cout << "0\n";
    return 0;
  }
  x = x % 1000000007LL;
  long long a = (x * pot(2, k + 1)) % 1000000007LL;
  long long b = (a - pot(2, k + 1) + 2) % 1000000007LL;
  if (b < 0) b += 1000000007LL;
  long long c = ((a + b) * inv(2)) % 1000000007LL;
  cout << c << "\n";
}
