#include <bits/stdc++.h>
using namespace std;
inline bool is_palindrome(const string& s) {
  return std::equal(s.begin(), s.end(), s.rbegin());
}
const long long MOD = 1000000007;
const long long INF = 1e9 + 5;
const double eps = 1e-7;
const double PI = acos(-1.0);
inline void debug_vi(vector<int> a) {
  for (long long i = (long long)(0); i < (long long)(a.size()); i++)
    cout << a[i] << " ";
}
inline void debug_vll(vector<long long> a) {
  for (long long i = (long long)(0); i < (long long)(a.size()); i++)
    cout << a[i] << " ";
}
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long x, k, ans = 0;
  cin >> x >> k;
  if (x == 0) {
    cout << 0;
    return 0;
  }
  ans = power(2LL, (k + 1) % (MOD - 1), MOD);
  ans %= MOD;
  ans *= (x) % MOD;
  ans %= MOD;
  ans -= power(2LL, (k) % (MOD - 1), MOD);
  ans += MOD + 1;
  ans %= MOD;
  cout << ans;
  return 0;
}
