#include <bits/stdc++.h>
using namespace std;
long long int recpow(long long int x, long long int n) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0)
    return recpow((x * x) % 1000000007, n / 2);
  else
    return (x * recpow((x * x) % 1000000007, (n - 1) / 2)) % 1000000007;
}
bool sortbysec(
    const pair<pair<long long int, long long int>, long long int> &a,
    const pair<pair<long long int, long long int>, long long int> &b) {
  if (a.second == b.second)
    return (a.first.second < b.first.second);
  else
    return (a.second > b.second);
}
string rev(string s) {
  string t;
  for (long long int i = s.length() - 1; i >= 0; i--) {
    t.push_back(s[i]);
  }
  return t;
}
bool comp(pair<long long int, long long int> a,
          pair<long long int, long long int> b) {
  if (a.first == b.first)
    return a.second < b.second;
  else
    return a.first < b.first;
}
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 << "\n";
    return 0;
  }
  long long int ans = recpow(2, k + 1);
  ans = (ans * (x % 1000000007)) % 1000000007;
  long long int t = recpow(2, k);
  ans = (ans - t + 1 + 1000000007) % 1000000007;
  cout << ans << "\n";
  return 0;
}
