#include <bits/stdc++.h>
using namespace std;
long long int powe(long long int a, long long int b) {
  if (b == 0)
    return 1;
  else if (b == 1)
    return a;
  else if (b % 2 == 0)
    return ((powe(a, b / 2)) * (powe(a, b / 2))) % 1000000007;
  else
    return ((powe(a, b / 2)) * a * (powe(a, b / 2))) % 1000000007;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, t, i, k, j, f, g;
  string s;
  cin >> n >> k;
  if (n == 0) {
    cout << 0 << "\n";
    return 0;
  }
  n %= 1000000007;
  long long int ans =
      (((n * powe(2, k + 1)) % 1000000007) + 1000000007 - powe(2, k) + 1) %
      1000000007;
  cout << ans % 1000000007 << "\n";
  return 0;
}
