#include <bits/stdc++.h>
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
using namespace std;
long long BigMod(long long B, long long P, long long M) {
  long long R = 1;
  while (P > 0) {
    if (P % 2 == 1) {
      R = (R * B) % M;
    }
    P /= 2;
    B = (B * B) % M;
  }
  return R;
}
long long histogram(long long arr[], long long n) {
  stack<int> s;
  int area = 0, i = 0;
  while (i < n) {
    if (s.empty() || arr[s.top()] <= arr[i])
      s.push(i++);
    else {
      int tp = s.top();
      s.pop();
      int xx = arr[tp] * (s.empty() ? i : i - s.top() - 1);
      area = max(area, xx);
    }
  }
  while (!s.empty()) {
    int tp = s.top();
    s.pop();
    int xx = arr[tp] * (s.empty() ? i : i - s.top() - 1);
    area = max(area, xx);
  }
  return area;
}
long long dp[2000010], arr[2000010];
int prime[2000010];
vector<int> v;
void seive() {
  for (int i = 2; i < 2000010; i++) {
    if (!prime[i]) {
      v.push_back(i);
      for (int j = i + i; j < 2000010; j += i) {
        prime[j] = 1;
      }
    }
  }
}
int main() {
  map<long long, int> mp;
  long long n, m, k, a, b, l, r;
  long long sum = 0;
  string s;
  cin >> n >> m;
  if (n == 0) {
    cout << 0 << endl;
    return 0;
  }
  if (m == 0) {
    cout << (n * 2) % 1000000007 << endl;
    return 0;
  }
  n = n % 1000000007;
  long long x = BigMod(2, m, 1000000007);
  long long xx = (n * x) % 1000000007;
  xx = (xx + 1000000007) % 1000000007;
  long long y = ((xx - x + 1) + 1000000007) % 1000000007;
  long long z = (((xx * 2)) + ((y * 2))) / 2;
  cout << ((z + 1000000007) % 1000000007) << endl;
  return 0;
}
