import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Rishabhdeep Singh
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        int MOD = (int) 1e9 + 7;

        long power(long a, long k) {
            long res = 1;
            while (k > 0) {
                if ((k & 1) != 0) {
                    res = res * a % MOD;
                }
                a = a * a % MOD;
                k /= 2;
            }
            return res;
        }

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            long x = in.nextLong(), k = in.nextLong();
            if (x == 0) {
                out.println(0);
                return;
            }
            long res = ((power(2, k + 1) % MOD) * (x % MOD)) % MOD;
            long temp = power(2, k);
            res = res - temp + 1;
            while (res < 0) res += MOD;
            out.println(res);
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void... What is the time complexity of the previous code?