#include <bits/stdc++.h>
using namespace std;
long long fast_expo(long long base, long long pow) {
  if (pow == 1) return (base);
  if (pow == 0) return (1);
  if (pow % 2 == 0) {
    long long a = fast_expo(base, pow / 2);
    return ((a * a) % 1000000007);
  } else {
    long long a = fast_expo(base, (pow - 1) / 2);
    return ((((a * a) % 1000000007) * base) % 1000000007);
  }
}
long long N, K;
int main() {
  cin >> N >> K;
  if (N == 0) {
    cout << 0 << endl;
    return (0);
  }
  N %= 1000000007;
  long long x = (fast_expo(2, K) * N) % 1000000007;
  long long extra = (fast_expo(2, K));
  long long prod1 = x - extra + 1;
  prod1 = (((prod1 + 1000000007) % 1000000007 + 1000000007) % 1000000007 +
           1000000007) %
          1000000007;
  long long answer = ((N * (x + 1)) % 1000000007);
  answer -= ((N - 1) * (prod1) % 1000000007);
  answer = ((answer + 1000000007) % 1000000007);
  cout << answer << endl;
  return (0);
}
