import java.io.*;
import java.util.*;
	
public	 class template
	{
		private InputStream is;
		private PrintWriter pw;
		static char[][] ch;
		static int  x1,x2,y1,y2,n,m,h,k;
		static long dist[][];
		static boolean boo[][];
		
		void soln()
		{
			is = System.in;
			pw = new PrintWriter(System.out);
			long s = System.currentTimeMillis();
			solve();
			pw.close();
			pw.flush();
			// tr(System.currentTimeMillis() - s + "ms");
		}
	
		public static void main(String[] args) throws Exception 
		{
			new Thread(null, new Runnable() 
			{
				public void run() 
				{
					try
					{
						// new CODEFORCES().soln();
					} catch (Exception e)
					{
						System.out.println(e);
					}
				}
			}, "1", 1 << 26).start();
			new template().soln();
		}
	
		void solve() 
		{
			long n = nl(), k = nl();
			if(n==0){
				pw.println(0);
				return;
			}
			long MOD = 1000000007;
			long pow1 = pow(2,k,MOD), pow2 = pow(2,k+1,MOD);
			pw.println(((((n%MOD)*pow2)%MOD) - (pow1-1+MOD)%MOD + 2*MOD)%MOD);
			pw.close();	
		}
		long pow(long x, long y, long mod){
			long ans = 1;
			while(y>0){
				if(y%2==0) {
					x *= x;
					x %= mod;
					y/=2;
				}
				else{
					ans *= x;
					ans %= mod;
					y-=1;
				}
			}
			return ans;
		}
		long gcd(long a, long b){
			if(b==0) return a;
			return gcd(b,a%b);
		}
		void printArray(long[] arr) {
			for(long i : arr) pw.print(i +" ");
			pw.println();
		}
	static long min(long x, long y){
		return (x<y)?x:y;
	}
	static class Pair implements Comparable<Pair>{
		long val;
		int  x, y;
		Pair(long v, int a, int b){
			val = v; x = a; y = b;
		}
		public int compareTo(Pair p){
			return Long.compare(this.val,p.val);
		}
	}
	private static class Queue{
		int st = 0;
		int et = 0;
		Pair[] arr;
		public Queue(int len) {
			arr = new Pair[len];
		}
		public boolean isEmpty() {
			return st==et;
		}
		public void add(Pair x) {
			arr[et++] = x;
		}
		public Pair poll() {
			return arr[st++];
		}
		public void clear() {
			st = et = 0;
		}
	}
		/*void bfs(int k) {
			while(!q.isEmpty())... Which one is the correct time complexity of the code snippet: constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard?