#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
  for (auto element : v) {
    os << element << " ";
  }
  return os;
}
template <typename T, typename second>
ostream& operator<<(ostream& os, pair<T, second>& p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T>& v) {
  auto endit = v.end();
  endit--;
  os << "[";
  for (auto it = v.begin(); it != v.end(); it++) {
    os << *it;
    if (it != endit) {
      os << ", ";
    }
  }
  os << "]";
  return os;
}
template <typename T, typename second>
ostream& operator<<(ostream& os, map<T, second>& v) {
  auto endit = v.end();
  endit--;
  os << "{";
  for (auto it = v.begin(); it != v.end(); it++) {
    os << "(" << (*it).first << " : " << (*it).second << ")";
    if (it != endit) {
      os << ", ";
    }
  }
  os << "}";
  return os;
}
vector<long long> fact(200001), ifact(200001);
long long power(long long x, long long n) {
  if (!n) return 1;
  if (n % 2)
    return (x * (power((x * x) % 1000000007, n / 2) % 1000000007)) % 1000000007;
  return power((x * x) % 1000000007, n / 2) % 1000000007;
}
long long inverse(long long n) {
  return power(fact[n], 1000000007 - 2) % 1000000007;
}
long long modinverse(long long n) {
  return power(n, 1000000007 - 2) % 1000000007;
}
void pre_factorials() {
  fact[0] = 1;
  for (long long i = 1; i < 200001; i++)
    fact[i] = (fact[i - 1] * i) % 1000000007;
  for (long long i = 0; i < 200001; i++) ifact[i] = inverse(i);
}
long long ncr(long long n, long long r) {
  if (n < r)
    return 0;
  else if (n == r)
    return 1;
  else if (r == 0)
    return 0;
  long long ans = fact[n];
  ans = (ans * ifact[r]) % 1000000007;
  ans = (ans * ifact[n - r]) % 1000000007;
  return ans;
}
void solve() {
  long long x, k;
  cin >> x >> k;
  long long num = power(2, k);
  if (x == 0) {
    cout << "0"
         << "\n";
    return;
  }
  x = x % 1000000007;
  long long tem = ((num * (num - 1))) % 1000000007;
  long long pro = power(2, k);
  pro = (pro * pro) % 1000000007;
  pro = (pro * x) % 1000000007;
  pro = (pro * 2) % 1000000007;
  long long sum = (((pro - tem) % 1000000007) + 1000000007) % 1000000007;
  long long ans = sum;
  tem = power(2, k);
  ans = (ans * modinverse(tem)) % 1000000007;
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  for (long long i = 0; i < t; i++) solve();
  return 0;
}
