#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int MOD = 1e9 + 7;
long long power(long long a, long long n, long long m = MOD) {
  if (n == 0) return 1;
  long long p = power(a, n >> 1, m);
  p = (p * p) % m;
  if (n & 1) p = (p * a) % m;
  return p;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long x, k;
  cin >> x >> k;
  if (x == 0) {
    cout << 0 << "\n";
    return 0;
  }
  x %= MOD;
  long long ra = (x * power(2, k)) % MOD;
  long long la = (ra - power(2, k) + MOD) % MOD;
  long long ans = (ra * (ra + 1) - la * (la + 1)) % MOD;
  ans = (ans + MOD) % MOD;
  ans = (ans * power(power(2, k), MOD - 2)) % MOD;
  cout << ans << "\n";
  ans %= MOD;
  if (ans < 0) ans += MOD;
  return 0;
}
