#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long n, k;
long long qpow(long long a, long long b) {
  long long ans = 1, base = a % mod;
  while (b) {
    if (b & 1) ans = (ans % mod) * (base % mod) % mod;
    base = (base % mod) * (base % mod) % mod;
    b >>= 1;
  }
  return ans;
}
int main() {
  cin >> n >> k;
  long long m = (qpow(2, k + 1) * (n % mod) - qpow(2, k) + 1) % mod;
  if (n == 0)
    cout << 0;
  else
    cout << (m + mod) % mod;
  return 0;
}
