#include <bits/stdc++.h>
using namespace std;
const long long int M = 1e9 + 7;
long long int power(long long int x, long long int y) {
  long long int temp = 1;
  long long int m = y;
  while (m > 0) {
    if (m & 1) temp = ((temp % M) * (x % M)) % M;
    x = ((x % M) * (x % M)) % M;
    m /= 2;
  }
  return temp;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int x, k;
  cin >> x >> k;
  if (x == 0) {
    cout << 0 << endl;
    return 0;
  }
  long long int a = ((x % M) * (power(2, k + 1))) % M;
  a = a + M + 1 - power(2, k) % M;
  cout << (a + M) % M << endl;
  return 0;
}
