#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) {
      res = (res * x) % p;
      if (res < 0) res += p;
    }
    y = y >> 1;
    x = (x * x) % p;
    if (x < 0) x += p;
  }
  return res;
}
long long int ck(long long int n) {
  if (n < 0) n += 1000000007;
  return n;
}
int main() {
  long long int n, m, k, i, s, j, x, y, p;
  cin >> n >> k;
  if (n == 0) {
    cout << 0;
    exit(0);
  }
  k++;
  m = power(2, k, 1000000007);
  m = ck(m);
  n = n % 1000000007;
  n = ck(n);
  m = (m * n) % 1000000007;
  m = ck(m);
  p = 0;
  if (k != 1) {
    p = power(2, k - 1, 1000000007);
    p = (p - 1 + 1000000007) % 1000000007;
    p = ck(p);
  }
  p = (m - p + 1000000007) % 1000000007;
  p = ck(p);
  cout << p;
}
