#include <bits/stdc++.h>
using namespace std;
tuple<long long int, long long int, long long int> mut_div(long long int a,
                                                           long long int b,
                                                           long long int c,
                                                           bool eff_c = true) {
  if (a == 0) {
    if (eff_c) {
      if (c % b != 0)
        return {-1, -1, -1};
      else
        return {abs(b), 0, c / b};
    } else {
      if (b < 0)
        return {-b, 0, -1};
      else
        return {b, 0, 1};
    }
  } else {
    auto [g, t, u] = mut_div(b % a, a, c, eff_c);
    if (g == -1) return {-1, -1, -1};
    return {g, u - (b / a) * t, t};
  }
}
tuple<long long int, long long int, long long int> eGCD(long long int a,
                                                        long long int b) {
  return mut_div(a, b, 0, false);
}
pair<long long int, long long int> crt_sub(long long int a1, long long int x1,
                                           long long int a2, long long int x2) {
  a1 = a1 % x1;
  a2 = a2 % x2;
  auto [g, s, t] = mut_div(x1, -x2, a2 - a1);
  if (g == -1) return {-1, -1};
  long long int z = x1 / g * x2;
  s = s % (x2 / g);
  long long int r = (x1 * s + a1) % z;
  if (r < 0) r += z;
  return {r, z};
};
long long int crt(long long int a1, long long int x1, long long int a2,
                  long long int x2) {
  return crt_sub(a1, x1, a2, x2).first;
}
long long int crt(vector<long long int> as, vector<long long int> xs) {
  assert(xs.size() == as.size() && xs.size() > 0);
  long long int r = as[0];
  long long int z = xs[0];
  for (size_t i = 1; i < xs.size(); i++) {
    tie(r, z) = crt_sub(r, z, as[i], xs[i]);
    if (r == -1) return -1;
  }
  return r;
}
long long int imod(long long int x, long long int y) {
  long long int v = x % y;
  if ((x >= 0) == (y >= 0))
    return v;
  else
    return v == 0 ? 0 : v + y;
}
long long int divFloor(long long int x, long long int y) {
  if (x > 0) {
    if (y > 0)
      return x / y;
    else
      return (x - y - 1) / y;
  } else {
    if (y > 0)
      return (x - y + 1) / y;
    else
      return x / y;
  }
}
long long int divCeil(long long int x, long long int y) {
  if (x > 0) {
    if (y > 0)
      return (x + y - 1) / y;
    else
      return x / y;
  } else {
    if (y > 0)
      return x / y;
    else
      return (x + y + 1) / y;
  }
}
struct Fp {
  static const long long int MOD = (1e9 + 7);
  long long int val;
  Fp(long long int t = 0) : val(imod(t, MOD)) {}
  Fp(const Fp& t) : val(t.val) {}
  Fp& operator=(const Fp& t) {
    val = t.val;
    return *this;
  }
  Fp& operator=(long long int t) {
    val = imod(t, MOD);
    return *this;
  }
  Fp& operator=(int t) {
    val = imod(t, MOD);
    return *this;
  }
  Fp& operator+=(const Fp& t) {
    val += t.val;
    if (val >= MOD) val -= MOD;
    return *this;
  }
  Fp& operator-=(const Fp& t) {
    val -= t.val;
    if (val < 0) val += MOD;
    return *this;
  }
  Fp& operator*=(const Fp& t) {
    val = (val * t.val) % MOD;
    return *this;
  }
  Fp inv() const {
    if (val == 0) {
      cerr << "inv() is called for zero." << endl;
      exit(1);
    }
    auto [g, u, v] = eGCD(val, MOD);
    return Fp(u);
  }
  Fp& operator/=(const Fp& t) { return (*this) *= t.inv(); }
  Fp operator+(const Fp& t) const { return Fp(val) += t; }
  Fp operator-(const Fp& t) const { return Fp(val) -= t; }
  Fp operator*(const Fp& t) const { return Fp(val) *= t; }
  Fp operator/(const Fp& t) const { return Fp(val) /= t; }
  Fp operator-() const { return Fp(-val); }
  bool operator==(const Fp& t) const { return val == t.val; }
  bool operator!=(const Fp& t) const { return val != t.val; }
  operator long long int() const { return val; }
};
Fp operator+(int x, const Fp& y) { return Fp(x) + y; }
Fp operator-(int x, const Fp& y) { return Fp(x) - y; }
Fp operator*(int x, const Fp& y) { return Fp(x) * y; }
Fp operator/(int x, const Fp& y) { return Fp(x) / y; }
Fp operator+(long long int x, const Fp& y) { return Fp(x) + y; }
Fp operator-(long long int x, const Fp& y) { return Fp(x) - y; }
Fp operator*(long long int x, const Fp& y) { return Fp(x) * y; }
Fp operator/(long long int x, const Fp& y) { return Fp(x) / y; }
Fp operator+(const Fp& x, int y) { return x + Fp(y); }
Fp operator-(const Fp& x, int y) { return x - Fp(y); }
Fp operator*(const Fp& x, int y) { return x * Fp(y); }
Fp operator/(const Fp& x, int y) { return x / Fp(y); }
Fp operator+(const Fp& x, long long int y) { return x + Fp(y); }
Fp operator-(const Fp& x, long long int y) { return x - Fp(y); }
Fp operator*(const Fp& x, long long int y) { return x * Fp(y); }
Fp operator/(const Fp& x, long long int y) { return x / Fp(y); }
istream& operator>>(istream& is, Fp& t) {
  long long int x;
  is >> x;
  t = x;
  return is;
}
ostream& operator<<(ostream& os, const Fp& t) {
  os << t.val;
  return os;
}
class Comb {
  int nMax;
  vector<Fp> vFact;
  vector<Fp> vInvFact;

 public:
  Comb(int nm) : nMax(nm), vFact(nm + 1), vInvFact(nm + 1) {
    vFact.at(0) = 1;
    for (int i = 1; i <= nMax; i++) vFact.at(i) = i * vFact.at(i - 1);
    vInvFact.at(nMax) = vFact.at(nMax).inv();
    for (int i = nMax; i >= 1; i--) vInvFact.at(i - 1) = i * vInvFact.at(i);
  }
  Fp fact(int n) { return vFact.at(n); }
  Fp comb(int n, int r) {
    return vFact.at(n) * vInvFact.at(r) * vInvFact.at(n - r);
  }
  Fp perm(int n, int r) { return vFact.at(n) * vInvFact.at(n - r); }
};
template <typename T>
T power(T a, long long int b) {
  T twoPow = a;
  T rv(1);
  while (b > 0) {
    if (b & 1LL) rv *= twoPow;
    twoPow *= twoPow;
    b >>= 1;
  }
  return rv;
}
template <typename T, typename Op>
T ah_power(T a, long long int b, const T& unit_t, Op op) {
  T two_pow = a;
  T ret = unit_t;
  while (b > 0) {
    if (b & 1LL) ret = op(ret, two_pow);
    two_pow = op(two_pow, two_pow);
    b >>= 1;
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);
  long long int x, k;
  cin >> x >> k;
  if (x == 0) {
    cout << 0 << endl;
    return 0;
  }
  Fp y = Fp(x) * power<Fp>(2, k + 1);
  Fp z = power<Fp>(2, k) - 1;
  cout << y - z << endl;
  return 0;
}
