#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.second < b.second);
}
long long int logy(long long int x, long long int y) {
  return ceil((long double)(log(x) / log(y)));
}
long long int powe(long long int a, long long int b) {
  long long int re = 1;
  while (b) {
    if (b & 1) re = (re * a) % 1000000007;
    a = (a * a) % 1000000007;
    b = b >> 1;
  }
  return re % 1000000007;
}
bool flag = 0, flag1 = 0, flag2 = 0;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int x, k;
  cin >> x >> k;
  if (x == 0) {
    cout << 0;
    return 0;
  }
  long long int ans = powe(2, k);
  ans = (ans * ((2 * x) % 1000000007 - 1) + 1 + 1000000007) % 1000000007;
  cout << ans;
  return 0;
}
