#include <bits/stdc++.h>
using namespace std;
int putere(long long int a, long long int b) {
  if (b == 0) {
    return 1;
  } else {
    if (b == 1)
      return a % 1000000007;
    else {
      long long int r;
      r = putere(a, b / 2);
      r = (r * r) % 1000000007;
      if (b % 2 == 0)
        return r;
      else
        return (r * a) % 1000000007;
    }
  }
}
int main() {
  long long int x, k, nr1, nr2;
  scanf("%lld%lld", &x, &k);
  if (x == 0)
    printf("0");
  else {
    x = x % 1000000007;
    nr1 = putere(2, k);
    nr2 = nr1 * x * 2 % 1000000007;
    printf("%lld", (nr2 - nr1 + 1 + 1000000007) % 1000000007);
  }
  return 0;
}
