#include <bits/stdc++.h>
using namespace std;
long long inv(long long a, long long b) {
  return (a > 1 ? b - inv(b % a, a) * b / a : 1);
}
const long double PI = 3.14159265359;
const long long inf = (1LL << 62);
const int iinf = (1 << 30);
const int mod = 1000000007;
long long n, k;
long long lgput(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % mod, b--;
    a = (a * a) % mod;
    b /= 2;
  }
  return ans;
}
int main() {
  cin >> n >> k;
  if (!n) return cout << 0, 0;
  n %= mod;
  long long aux = lgput(1LL * 2, k);
  n = (n * aux) % mod;
  n = (2 * n - aux + 1) % mod;
  cout << (n + mod) % mod;
  return 0;
}
