import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.HashSet;
import java.util.StringTokenizer;

/**
 * Created by artur on 18/06/18
 */
public class A
{
    private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private StringTokenizer tokenizer = null;

    long mod = 1000000007;

    public static void main(String[] args) throws IOException
    {
        new A().solve();
    }

    private void solve() throws IOException
    {
        long x = nl();
        long k = nl();

        if (x == 0)
        {
            System.out.println(0);
            System.exit(0);
        }

        if (k == 0)
        {
            System.out.println((x * 2) % mod);
            System.exit(0);
        }

//        for (int sx = 0; sx < 100; sx++)
//        {
//            for (int sk = 0; sk < 100; sk++)
//            {
//                BigInteger n = BigInteger.valueOf(2)
//                        .modPow(BigInteger.valueOf(k + 1), BigInteger.valueOf(mod))
//                        .multiply(BigInteger.valueOf(x))
//                        .add(BigInteger.ONE)
//                        .subtract(BigInteger.valueOf(2)
//                                .modPow(BigInteger.valueOf(k), BigInteger.valueOf(mod)))
//                        .mod(BigInteger.valueOf(mod));
//                long res = n.longValue();
//
//                long aux = aux(sx, sk);
//                if ((res % mod) != aux) {
//                    System.out.println(sx + " " + sk + ": " + res + " " + aux);
//                }
//            }
//        }

        BigInteger n = BigInteger.valueOf(2)
                .modPow(BigInteger.valueOf(k + 1), BigInteger.valueOf(mod))
                .multiply(BigInteger.valueOf(x))
                .add(BigInteger.ONE)
                .subtract(BigInteger.valueOf(2)
                        .modPow(BigInteger.valueOf(k), BigInteger.valueOf(mod)))
                .mod(BigInteger.valueOf(mod));

        System.out.println(n.toString());
    }

    long aux(long x, long k) {
        long p1 = 2 * x;
        long p2 = 2 * x - 1;

        for (int i = 0; i < k - 1; i++)
        {
            p1 = (p1 * 2) % mod;
            p2 = (p2 * 2 - 1) % mod;
        }

        return ((p1 + p2) % mod);
    }

    void debug(Object... os)
    {
        System.out.println(Arrays.deepToString(os));
    }

    int ni() throws IOException
    {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException
    {
        return Long.parseLong(ns());
    }

    double nd() throws IOException
    {
        return Double.parseDouble(ns());
    }

    String ns() throws IOException
    {
        while (tokenizer == null || !tokenizer.hasMoreTokens())
            tokenizer = new StringTokenizer(br.readLine());
        return tokenizer.nextToken();
    }

    String nline() throws IOException
    {
        tokenizer = null;
        return br.readLine();
    }

    private static long gcd(long a, long b)
    {
        while (b > 0)
        {
            long temp = b;
            b = a % b; // % is remainder
            a = temp;
        }
        return a;
    }

    private static long lcm(long a, long b)
    {
        return a * (b / gcd(a, b));
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
import java.util.Stack;
import java.util.StringTokenizer;

public class Main {

	static boolean visited[] ;
	static boolean ends[] ;
	static long mod = 1000000007 ;
	static int lens[] ;
	static int seeds[] ;
	static int a[] ;
	static double total ;
	public static ArrayList adj[] ;
	public static long x,y ;
	public static ArrayList<Long> xx ;
	public static void main(String[] args) throws IOException, InterruptedException {
		Scanner sc =  new Scanner(System.in) ;

		long x = sc.nextLong() ;
		long k = sc.nextLong() ;
		if(x==0)
		{System.out.println(0); return ;}
		if(k==0)
		{System.out.println((2l*x)%mod);return ;}

		long m=pow(2,k);

		long a = 2l*(x%mod)*(m%mod);

		a = a-m+1 ;

		a=a%mod ;
		if(a<0)a=(a%mod + mod) % mod;

		System.out.println(a);

	}

	// method to print the divisors
	static ArrayList<Long> divisors(long n)
	{
		ArrayList<Long> arr =  new ArrayList<Long>() ;
		// Note that this loop runs till square root
		for (int i=1; i<=Math.sqrt(n); i++)
		{
			if (n%i==0)

				// If divisors are equal, print only one
				if (n/i == i)
				{arr.add(1l*i);arr.add(1l*i);}

				else // Otherwise print both
				{arr.add(1l*i); arr.add(1l*n/i);}

		}

		return arr ;

	}

	public static void generate(long current)
	{
		if(current>10000000000l)
			return ;

		xx.add(current) ;
		generate((10*current) +4);
		generate((10*current) +7);

	}

	public static int neededFromLeft(String x)
	{
		Stack<Character> st = new Stack<Character>() ;
		int c=0;

		for (int i = 0; i < x.length(); i++)
		{
			char cur = x.charAt(i);
			if(cur==')' && st.isEmpty())
				c ++;
			else if(cur==')' && !st.isEmpty())
				st.pop();
			else if(cur=='(')
				st.push(cur);
		}
		return c;
	}

	public static int neededFromRight(String x)
	{
		Stack<Character> st = new Stack<Character>() ;
		int c=0;
		boolean f=true;
		for (int i = 0; i < x.length(); i++)
		{
			char cur = x.charAt(i);
			if(cur==')' && st.isEmpty())
				f=false;
			else if(cur==')' && !st.isEmpty())
				st.pop();
			else if(cur=='(')
				st.push(cur);
		}
		return st.size();
	}

	public static boolean fromBoth(String x)
	{
		Stack<Character> st = new Stack<Character>() ;
		boolean f1=true ,f2=true ;

		for (int i = 0; i < x.length(); i++)
		{
			char cur = x.charAt(i);
			if(cur==')' && st.isEmpty())
				f1 =false ;
			else if(cur==')' && !st.isEmpty())
				st.pop();
			else if(cur=='(')
				st.push(cur);
		}
		if(st.size()>0)f2 = false ;

		if(f1==false && f2==false)
			return true ;
		else
			return false;
	}

	public static boolean isRegular(String x)
	{
		Stack<Character> st = new Stack<Character>() ;
		for (int i = 0; i < x.length(); i++)
		{
			char cur = x.charAt(i);
			if(cur==')' && st.isEmpty())
				return false ;
			else if(cur==')' && !st.isEmpty())
				st.pop();
			else if(cur=='(')
				st.push(cur);
		}
		if(st.size()>0)return false ; else return true ;
	}

	public static int gcdExtended(int a, int b)
	{
		// Base Case
		if (a == 0)
		{
			x = 0;
			y = 1;
			return b;
		}

		//int x1=1, y1=1; // To store results of recursive call
		int gcd = gcdExtended(b%a, a);

		// Update x and y using results of recursive
		// call
		long x1 = y - (b/a) * x;
		long y1 = x;
		x = x1 ;
		y = y1 ;

		return gcd;
	}

	static int even(String x , int b )
	{
		for (int j = b; j>=0; j--)
		{
			int current = x.charAt(j)-48 ;
			if(current%2==0)
				return current ;
		}
		return -1;
	}
	static int odd(String x , int b )
	{
		for (int j = b; j>=0; j--)
		{
			int current = x.charAt(j)-48 ;
			if(current%2!=0)
				return current ;
		}
		return -1;
	}
	static long pow(long base, long k) {
		long res = 1;
		while(k > 0) {
			if(k % 2 == 1) {
				res = (res * base) % mod;
			}

			base = (base * base) % mod;
			k /= 2;
		}

		return res;
	}
	public static long solve(int k1, long k2)
	{
		long x   = 1l*k2*(pow(2, k1)-1) ;
		return x%(1000000007) ;
	}

	public static long getN(long x)
	{
		long n = (long) Math.sqrt(x*2) ;
		long y = n*(n+1)/2;
		if(y==x)
			return n ;
		else if(y>x)
			return n ;
		else
			for (long i = n; ; i++)
			{
				y = i*(i+1)/2 ;
				if(y>=x)
					return i ;

			}	}

	public static void dfss(int root , int len)
	{
		visited[root]=true ;
		if(ends[root] && root!=0) lens[root] = len ;

		for (int i = 0; i < adj[root].size(); i++)
		{
			int c= (int) adj[root].get(i) ;
			if(visited[c]==false)
				dfss(c, len+1);
		}
	}

	public static void pr(int root ,  int seed){
		visited[root] = true ;
		int dv = adj[root].size()-1 ;
		if(root==0) dv++ ;

		for (int i = 0; i < adj[root].size(); i++)
		{
			int c = (int)adj[root].get(i) ;
			seeds[c]=dv*seed ;
		}

		for (int i = 0; i < adj[root].size() ; i++)
		{
			int c = (int)adj[root].get(i) ;
			if(visited[c]==false)
				pr(c , seeds[c]);

		}

	}

	public static String concatinate(String s ,int n)
	{
		if(s.length()==n)
			return s ;
		else return concatinate("0"+s, n) ;
	}
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}

	public static long getGCD(long n1, long n2) {
		if (n2 == 0) {
			return n1;
		}
		return getGCD(n2, n1 % n2);
	}

	public static int cnt1(int mat[][])  //how many swaps to be a 1 matrix
	{
		int m = mat.length ;
		int c=0 ;
		for (int i = 0; i < mat.length; i++)
		{
			for (int j = 0; j < mat.length; j++)
			{
				int x =  (i*m) +j ;
				if(x%2==0 && mat[i][j]==0)
					c++;
				if(x%2!=0 && mat[i][j]==1)
					c++;

			}
		}
		return c;
	}
	public static int cnt0(int mat[][])
	{
		int m = mat.length ;
		int c=0 ;
		for (int i = 0; i < mat.length; i++)
		{
			for (int j = 0; j < mat.length; j++)
			{
				int x =  (i*m) +j ;
				if(x%2!=0 && mat[i][j]==0)
					c++;
				if(x%2==0 && mat[i][j]==1)
					c++;

			}
		}
		return c;
	}

	public static boolean canFit2(int x1, int y1 , int x2 , int y2 , int x3 , int y3){
		if(x1==x2)
			if(x1==x3)
				return true ;
			else
				return false ;
		else
			if(x1==x3)
				return false ;
			else
			{
				long a = 1l*(y2-y1)*(x3-x2) ;
				long b = 1l*(y3-y2)*(x2-x1) ;

				if(a==b)
					return true;
				else
					return false ;

			}

	}
	public static void shuffle(pair[] ss){
		if(ss.length==1)
			return ;
		for (int i = 0; i < ss.length; i++)
		{
			Random rand = new Random();

			int  n = rand.nextInt(ss.length-1) + 0;

			pair temp = ss[i] ;
			ss[i] = ss[n] ;
			ss[n] = temp ;
		}
	}
	public static int binary(ArrayList<pair> arr, int l, int r, long x)   /// begin by 0 and n-1
	{
		if (r>=l)
		{
			int mid = l + (r - l)/2;
			if (arr.get(mid).x== x)
				return mid;
			if (arr.get(mid).x> x)
				return binary(arr, l, mid-1, x);
			return binary(arr, mid+1, r, x);
		}
		return -1;
	}

	/// searching for the index of first elment greater than x
	public static int binary1(int[]arr , int x) {
		int low = 0, high = arr.length; // numElems is the size of the array i.e arr.size()
		while (low != high) {
			int mid = (low + high) / 2; // Or a fancy way to avoid int overflow
			if (arr[mid] <= x) {
				/* This index, and everything below it, must not be the first element
				 * greater than what we're looking for because this element is no greater
				 * than the element.
				 */
				low = mid + 1;
			}
			else {
				/* This element is at least as large as the element, so anything after it can't
				 * be the first element that's at least as large.
				 */
				high = mid;
			}
		}
		return low ; // return high ;
	}

	////// searching for last element less than X
	public static int binary2(pair[]arr , int x) {
		int low = 0, high = arr.length; // numElems is the size of the array i.e arr.size()
		while (low != high) {
			int mid = (low + high) / 2; // Or a fancy way to avoid int overflow
			if (arr[mid].x >= x) {
				/* This index, and everything below it, must not be the first element
				 * greater than what we're looking for because this element is no greater
				 * than the element.
				 */
				high=mid;
			}
			else {
				/* This element is at least as large as the element, so anything after it can't
				 * be the first element that's at least as large.
				 */
				low = mid+1 ;
			}
		}
		return low ; // return high ;
	}

	private static boolean triangle(int a, int b , int c){
		if(a+b>c && a+c>b && b+c>a)
			return true ;
		else
			return false ;
	}
	private static boolean segment(int a, int b , int c){
		if(a+b==c || a+c==b && b+c==a)
			return true ;
		else
			return false ;
	}
	private static int gcdThing(long a, long b) {
		BigInteger b1 = BigInteger.valueOf(a);
		BigInteger b2 = BigInteger.valueOf(b);
		BigInteger gcd = b1.gcd(b2);
		return gcd.intValue();
	}

	public static boolean is(int i){
		if(Math.log(i)/ Math.log(2) ==(int) (Math.log(i)/ Math.log(2)))
			return true ;
		if(Math.log(i)/ Math.log(3) ==(int) (Math.log(i)/ Math.log(3)) )
			return true ;
		if(Math.log(i)/ Math.log(6) ==(int) (Math.log(i)/ Math.log(6)) )
			return true ;

		return false;

	}
	public static boolean contains(int b[] , int x)
	{
		for (int i = 0; i < b.length; i++)
		{
			if(b[i]==x)
				return true ;
		}
		return false ;
	}
	public static int binary(long []arr , long target , int low , long shift) {
		int high = arr.length;
		while (low != high) {
			int mid = (low + high) / 2;
			if (arr[mid]-shift <= target) {
				low = mid + 1;
			}
			else {
				high = mid;
			}
		}
		return low ; // return high ;
	}
	public static boolean isLetter(char x){
		if(x+0 <=122 && x+0 >=97 )
			return true ;
		else if (x+0 <=90 && x+0 >=65 )
			return true ;
		else return false;
	}
	public static long getPrimes(long x ){
		if(x==2 || x==3 || x==1)
			return 2 ;
		if(isPrime(x))
			return 5 ;
		for (int i = 2; i*i<=x; i++)
		{
			if(x%i==0 && isPrime(i))
				return getPrimes(x/i) ;
		}
		return -1;
	}
	public static String solve11(String x){

		int n = x.length() ;
		String y = "" ;
		for (int i = 0; i < n-2; i+=2)
		{
			if(ifPalindrome(x.substring(i, i+2)))
				y+= x.substring(i, i+2) ;
			else
				break ;
		}
		return y+ solve11(x.substring(y.length(),x.length())) ;

	}
	public static String solve1(String x){
		String y = x.substring(0 , x.length()/2) ;
		return "" ;

	}
	public static String reverse(String x){
		String y ="" ;
		for (int i = 0; i < x.length(); i++)
		{
			y  = x.charAt(i) + y ;
		}
		return y ;
	}

	public static boolean ifPalindrome(String x){
		int numbers[] = new int[10] ;
		for (int i = 0; i < x.length(); i++)
		{
			int z = Integer.parseInt(x.charAt(i)+"") ;
			numbers[z] ++ ;
		}
		for (int i = 0; i < numbers.length; i++)
		{
			if(numbers[i]%2!=0)
				return false;
		}
		return true ;
	}

	public static int get(int n){
		return n*(n+1)/2 ;
	}
	//		public static long getSmallestDivisor( long y){
	//			if(isPrime(y))
	//				return -1;
	//
	//			for (long i = 2; i*i <= y; i++)
	//			{
	//				if(y%i ==0)
	//				{
	//					return i;
	//				}
	//			}
	//			return -1;
	//		}
	public static int lis( int[]a , int n){
		int lis[] = new int[n] ;
		Arrays.fill(lis,1) ;

		for(int i=1;i<n;i++)
			for(int j=0 ; j<i; j++)
				if (a[i]>a[j] &&  lis[i] < lis[j]+1)
					lis[i] = lis[j] + 1;

		int max = lis[0];

		for(int i=1; i<n ; i++)
			if (max < lis[i])
				max = lis[i] ;
		return (max);

		//			ArrayList<Integer> s = new ArrayList<Integer>() ;
		//			for (int i = n-1; i >=0; i--)
		//			{
		//				if(lis[i]==max)
		//				{
		//					s.add(a[i].z);
		//					max --;
		//				}
		//			}
		//
		//			for (int i = s.size()-1 ; i>=0 ;  i--)
		//			{
		//				System.out.print(s.get(i)+" ");
		//			}
		//
	}
	public static int calcDepth(Vertix node){
		if(node.depth>0) return node.depth;
		// meaning it has been updated before;
		if(node.parent != null)
			return 1+ calcDepth(node.parent);
		else
			return -1;
	}

	public static boolean isPrime (long num){
		if (num < 2) return false;
		if (num == 2) return true;
		if (num % 2 == 0) return false;
		for (int i = 3; i * i <= num; i += 2)
			if (num % i == 0) return false;
		return true;
	}

	public static ArrayList<Long> getDiv(Long n)
	{
		ArrayList<Long>  f = new ArrayList<Long>() ;

		while (n%2==0)
		{
			if(!f.contains(2))f.add((long) 2) ;
			n /= 2;
		}

		// n must be odd at this point.  So we can
		// skip one element (Note i = i +2)
		for (long i = 3; i <= Math.sqrt(n); i+= 2)
		{
			// While i divides n, print i and divide n
			while (n%i == 0)
			{
				if(!f.contains(i))f.add(i);
				n /= i;
			}
		}

		// This condition is to handle the case whien
		// n is a prime number greater than 2
		if (n > 2)
			if(!f.contains(n))f.add(n);

		return f ;

	}

	//		public static boolean dfs(Vertix v , int target){
	//			try{
	//				visited[v.i]= true ;
	//			} catch (NullPointerException e)
	//			{
	//				System.out.println(v.i);
	//			}
	//			if(v.i == target)
	//
	//				return true ;
	//			for (int i =0 ; i< v.neighbours.size() ; i++)
	//			{
	//
	//				Vertix child = v.neighbours.get(i) ;
	//				if(child.i == target){
	//					found = true  ;
	//				}
	//				if(visited[child.i]==false){
	//					found |= dfs(child, target) ;
	//				}
	//			}
	//			return found;
	//		}

	public static class Vertix{
		long i ;
		int depth ;
		ArrayList<Vertix> neighbours ;
		Vertix parent ;
		Vertix child ;

		public Vertix(long i){
			this.i = i ;
			this.neighbours = new ArrayList<Vertix> () ;
			this.parent = null ;
			depth =-1;
			this.child = null ;
		}
	}

	public static class pair implements Comparable<pair> {
		int x ;
		int y ;
		int i;

		public pair(int x, int y, int i ){

			this.x=x ;
			this.y =y ;
			this.i =i ;

		}

		@Override
		public int compareTo(pair p) {
			if(this.x > p.x)
				return 1 ;
			else if (this.x == p.x)
				return 0 ;
			else
				return -1 ;
		}

	}

	public static class pair2 implements Comparable<pair2>{
		int i ;
		int j ;
		int plus ;

		public pair2(int i , int j , int plus){
			this.i =i ;
			this.j = j ;
			this.plus = plus ;
		}

		@Override
		public int compareTo(pair2 p) {
			if(this.j > p.j)
				return 1 ;
			else if (this.j == p.j) return 0 ;
			else
				return -1 ;
		}

	}
	public static class point implements  Comparable<point>
	{
		int x, y ;
		public point(int x,int y){
			this.x=x ; this.y=y;
		}
		@Override
		public boolean equals(Object o) {

			// If the object is compared with itself then return true
			if (o == this) {
				return true;
			}

			/* Check if o is an instance of Complex or not
	          "null instanceof [type]" also returns false */
			if (!(o instanceof point)) {
				return false;
			}

			// typecast o to Complex so that we can compare data members
			point c = (point) o;

			// Compare the data members and return accordingly
			return Integer.compare(x, c.x) == 0
					&& Integer.compare(y, c.y) == 0;
		}
		@Override
		public int compareTo(point p) {
			if(this.x == p.x && this.y ==p.y)
				return 0 ;
			else
				return -1 ;
		}

		@Override
		public int hashCode()
		{
			return 15+x+(y%2) ;
		}

	}

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static final class TaskC {
        private static final int MODULO = 1_000_000_000 + 7;

        public void solve(int __, InputReader in, PrintWriter out) {
            long qty = in.nextLong();
            long months = in.nextLong();
            if (qty == 0) {
                out.println(0);
                return;
            }
            qty %= MODULO;
            long pow = pow(2, months + 1);
            qty = (qty * pow) % MODULO;
            long sub = (pow - 2 + MODULO) % MODULO * pow(2, MODULO - 2) % MODULO;
            qty = (qty - sub + MODULO) % MODULO;
            out.println(qty);
        }

        private long pow(long base, long power) {
            long result = 1;
            while (power > 0) {
                if ((power & 1) != 0) {
                    result = (result * base) % MODULO;
                }
                base = (base * base) % MODULO;
                power >>>= 1;
            }
            return result;
        }

    }

    static class InputReader {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(readLine());
            }
            return tokenizer.nextToken();
        }

        public String readLine() {
            String line;
            try {
                line = reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return line;
        }
    }
}


import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
public class C {
    public static void main(String[] args) throws Exception {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        // Scanner scan = new Scanner(System.in);
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        // int n = Integer.parseInt(bf.readLine());
        StringTokenizer st = new StringTokenizer(bf.readLine());
        // int[] a = new int[n]; for(int i=0; i<n; i++) a[i] = Integer.parseInt(st.nextToken());

        long n = Long.parseLong(st.nextToken());
        long k = Long.parseLong(st.nextToken());
        int mod = 1000000007;

        if(n == 0) {
          out.println(0);
          out.close(); System.exit(0);
        }
        n %= mod;

        long ans = exp(2, (int)((k+1) % (mod-1)), mod);
        ans = (1L*ans * n) % mod;
        ans = ans + mod + 1 - exp(2, (int)((k) % (mod-1)), mod);
        ans %= mod;
        out.println(ans);
        // int n = scan.nextInt();

        out.close(); System.exit(0);
    }
    public static int exp(int base, int e, int mod) {
      if(e == 0) return 1;
      if(e == 1) return base;
      int val = exp(base, e/2, mod);
      int ans = (int)(1L*val*val % mod);
      if(e % 2 == 1)
        ans = (int)(1L*ans*base % mod);
      return ans;
    }
}


import java.io.*;

import java.util.*;

public class ModifyLongest {

    InputStream is;

    PrintWriter out;

    String INPUT = "";

    //boolean codechef=true;

    boolean codechef=true;

    void solve()
    {
        /*
        long l=ni(),r=ni(),x=ni(),y=ni();
        long prod=x;
        prod*=y;
        int cnt=0;
        if(l==r && r==x && x==y && x==1)
        {
            System.out.println(1);
            return;
        }
        //HashSet<Long> set=new HashSet<>();
        for(long i=2;i<=Math.sqrt(prod);i++)
        {
            if(prod%i==0)
            {
                if(Math.min(i,prod/i)>=l && Math.max(i,prod/i)<=r && gcd(i,prod/i)==x)
                {
                    //set.add(fnc2(i,prod/i));
                    //set.add(fnc2(prod/i,i));
                    if(i!=prod/i)cnt+=2;
                    else cnt++;
                }
            }
        }
        ArrayList<Long> factors=new ArrayList<>();
        while(prod!=1)
        {
            long currF=PollardRho(prod);
            while(prod%currF!=0)
            {
                prod/=currF;
                factors.add(currF);
            }

        }

        if(l==1)
        {
            System.out.println((cnt+2));
        }
        else
        {
            System.out.println(cnt);
        }

*/
        long mod=1000000007;
        long x=nl(),k=nl();
        if(x==0)
        {
            System.out.println(0);
            return;
        }
        long val=calc((pow(2,k,mod)*(x%mod))%mod);
        val-=calc(((pow(2,k,mod)*(x%mod))%mod-(pow(2,k,mod)-1)-1+mod)%mod);
        //val*=2;

        val=(val+mod)%mod;
        val=(val*inv(pow(2,k,mod),mod))%mod;
        System.out.println(val);

    }

    static long calc(long a)
    {
        long b=(a*(a+1))%1000000007;
        return b;
    }

    /* method to return prime divisor for n */
    long PollardRho(long n)
    {
        /* initialize random seed */
        //srand (time(NULL));

        /* no prime divisor for 1 */
        if (n==1) return n;

        /* even number means one of the divisors is 2 */
        if (n % 2 == 0) return 2;
        Random r=new Random();
        /* we will pick from the range [2, N) */
        long x = (r.nextLong()%(n-2))+2;
        long y = x;

        /* the constant in f(x).
         * Algorithm can be re-run with a different c
         * if it throws failure for a composite. */
        long c = (r.nextLong()%(n-1))+1;

        /* Initialize candidate divisor (or result) */
        long d = 1;

    /* until the prime factor isn't obtained.
       If n is prime, return n */
        while (d==1)
        {
            /* Tortoise Move: x(i+1) = f(x(i)) */
            x = (pow(x, 2, n) + c + n)%n;

            /* Hare Move: y(i+1) = f(f(y(i))) */
            y = (pow(y, 2, n) + c + n)%n;
            y = (pow(y, 2, n) + c + n)%n;

            /* check gcd of |x-y| and n */
            d = gcd(Math.abs(x-y), n);

            /* retry if the algorithm fails to find prime factor
             * with chosen x and c */
            if (d==n) return PollardRho(n);
        }

        return d;
    }

    static HashMap<Long,HashSet<Long>> globalSet;

    static long fnc(int a,int b)

    {

        long val=Math.min(a,b)*1000000007;

        val+=Math.max(a,b);

        return val;

    }

    static long fnc2(long a,long b)

    {

        long val=a*1000000007;

        val+=b;

        return val;

    }

    static class Pair

    {

        int a,b;

        public Pair(int a,int b)

        {

            this.a=a;

            this.b=b;

        }

    }

    static int bit[];

    static void add(int x,int d,int n)

    {

        for(int i=x;i<=n;i+=i&-i)bit[i]+=d;

    }

    static int query(int x)

    {

        int ret=0;

        for(int i=x;i>0;i-=i&-i)

            ret+=bit[i];

        return ret;

    }

    static long lcm(int a,int b)

    {

        long val=a;

        val*=b;

        return (val/gcd(a,b));

    }

    static long gcd(long a,long b)

    {

        if(a==0)return b;

        return gcd(b%a,a);

    }

    static long pow(long a, long b, long p)

    {

        long ans = 1, base = a;

        while (b!=0)

        {

            if ((b & 1)!=0)

            {

                ans *= base;

                ans%= p;

            }

            base *= base;

            base%= p;

            b >>= 1;

        }

        return ans;

    }

    static long inv(long x,long p)

    {

        return pow(x, (int)p - 2, p);

    }

    void run() throws Exception

    {

        if(codechef)oj=true;

        is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());

        out = new PrintWriter(System.out);

        long s = System.currentTimeMillis();

        solve();

        out.flush();

        tr(System.currentTimeMillis()-s+"ms");

    }

    public static void main(String[] args) throws Exception {new ModifyLongest().run();}

    private byte[] inbuf = new byte[1024];

    public int lenbuf = 0, ptrbuf = 0;

    private int readByte()

    {

        if(lenbuf == -1)throw new InputMismatchException();

        if(ptrbuf >= lenbuf){

            ptrbuf = 0;

            try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }

            if(lenbuf <= 0)return -1;

        }

        return inbuf[ptrbuf++];

    }

    private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }

    private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

    private double nd() { return Double.parseDouble(ns()); }

    private char nc() { return (char)skip(); }

    private String ns()

    {

        int b = skip();

        StringBuilder sb = new StringBuilder();

        while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')

            sb.appendCodePoint(b);

            b = readByte();

        }

        return sb.toString();

    }

    private char[] ns(int n)

    {

        char[] buf = new char[n];

        int b = skip(), p = 0;

        while(p < n && !(isSpaceChar(b))){

            buf[p++] = (char)b;

            b = readByte();

        }

        return n == p ? buf : Arrays.copyOf(buf, p);

    }

    private char[][] nm(int n, int m)

    {

        char[][] map = new char[n][];

        for(int i = 0;i < n;i++)map[i] = ns(m);

        return map;

    }

    private int[] na(int n)

    {

        int[] a = new int[n];

        for(int i = 0;i < n;i++)a[i] = ni();

        return a;

    }

    private int ni()

    {

        int num = 0, b;

        boolean minus = false;

        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));

        if(b == '-'){

            minus = true;

            b = readByte();

        }

        while(true){

            if(b >= '0' && b <= '9'){

                num = num * 10 + (b - '0');

            }else{

                return minus ? -num : num;

            }

            b = readByte();

        }

    }

    private long nl()

    {

        long num = 0;

        int b;

        boolean minus = false;

        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));

        if(b == '-'){

            minus = true;

            b = readByte();

        }

        while(true){

            if(b >= '0' && b <= '9'){

                num = num * 10 + (b - '0');

            }else{

                return minus ? -num : num;

            }

            b = readByte();

        }

    }

    private boolean oj = System.getProperty("ONLINE_JUDGE") != null;

    private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	private void solve() throws IOException {

		out.println(solve(nl()));
		out.close();

	}

	private long solve(long n) throws IOException {
		if (n > 0) {
			n <<= 1;
			long k = nl();
			n--;
			int M = 1000000007;
			long p = power(2, k, M);
			// Helper.tr(n * p + 1);
			n = (n % M * p + 1) % M;
		}
		return n;
	}

	long power(long a, long b, long mod) {
		long x = 1, y = a;
		while (b > 0) {
			if (b % 2 != 0) {
				x = (x * y) % mod;
			}
			y = (y * y) % mod;
			b /= 2;
		}
		return x % mod;
	}

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	private int[][] na(int n) throws IOException {
		int[][] a = new int[n][2];
		for (int i = 0; i < n; i++) {
			a[i][0] = ni();
			a[i][1] = i;
		}
		return a;
	}

	String ns() throws IOException {
		while (!tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine(), " ");
		}
		return tok.nextToken();
	}

	int ni() throws IOException {
		return Integer.parseInt(ns());
	}

	long nl() throws IOException {
		return Long.parseLong(ns());
	}

	double nd() throws IOException {
		return Double.parseDouble(ns());
	}

	String[] nsa(int n) throws IOException {
		String[] res = new String[n];
		for (int i = 0; i < n; i++) {
			res[i] = ns();
		}
		return res;
	}

	int[] nia(int n) throws IOException {
		int[] res = new int[n];
		for (int i = 0; i < n; i++) {
			res[i] = ni();
		}
		return res;
	}

	long[] nla(int n) throws IOException {
		long[] res = new long[n];
		for (int i = 0; i < n; i++) {
			res[i] = nl();
		}
		return res;
	}

	public static void main(String[] args) throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		tok = new StringTokenizer("");
		Main main = new Main();
		main.solve();
		out.close();
	}
}


import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Iterator;
import java.util.Vector;

public class con67 {

	public static void main(String[] args) throws IOException
	{
//	System.out.println(power(2,9,1000000007));
	long x=l();
	long k=l();
if(x!=0)
{
	long f=x%1000000007;
	long s=(f*power(2,k+1,1000000007))%1000000007;
	//out.println(s);
	long e=	(power(2,k,1000000007)-1)%1000000007;
	//out.println(e);
	long ans=(s-e+1000000007)%1000000007;

	out.println(ans);

}
else
{
	out.println(0);
}
	out.close();
	}

	static long power(long x, long y, long p)
    {
        // Initialize result
        long res = 1;

        // Update x if it is more
        // than or equal to p
        x = x % p;

        while (y > 0)
        {
            // If y is odd, multiply x
            // with result
            if((y & 1)==1)
                res = (res * x) % p;

            // y must be even now
            // y = y / 2
            y = y >> 1;
            x = (x * x) % p;
        }
        return res;
    }

	 static InputReader in = new InputReader(System.in);
	    static OutputWriter out = new OutputWriter(System.out);

	    static int i()
	    {
	    	return in.readInt();
	    }

	    static long l()
	    {
	    	return in.readLong();
	    }

	    static double d()
	    {
	    	return in.readDouble();
	    }

	    static String s()
	    {
	    	return in.readString();
	    }

	    static void Iarr( int[] array, int no )
	    {
	    	for( int i=0 ; i<no ; i++ )
	    	{
	    		array[i] = i();
	    	}
	    }

	    static void Larr( long[] array, int no )
	    {
	    	for( int i=0 ; i<no ; i++ )
	    	{
	    		array[i] = l();
	    	}
	    }

	    static void Darr( double[] array, int no )
	    {
	    	for( int i=0 ; i<no ; i++ )
	    	{
	    		array[i] = d();
	    	}
	    }

	    static void Sarr( String[] array, int no )
	    {
	    	for( int i=0 ; i<no ; i++ )
	    	{
	    		array[i] = s();
	    	}
	    }

	    private static class InputReader
	    {
	        private InputStream stream;
	        private byte[] buf = new byte[1024];
	        private int curChar;
	        private int numChars;
	        private SpaceCharFilter filter;

	        public InputReader(InputStream stream)
	        {
	            this.stream = stream;
	        }

	        public int read()
	        {
	            if (numChars == -1)
	                throw new InputMismatchException();
	            if (curChar >= numChars)
	            {
	                curChar = 0;
	                try
	                {
	                    numChars = stream.read(buf);
	                } catch (IOException e)
	                {
	                    throw new InputMismatchException();
	                }
	                if (numChars <= 0)
	                    return -1;
	            }
	            return buf[curChar++];
	        }

	        public int readInt()
	        {
	            int c = read();
	            while (isSpaceChar(c))
	                c = read();
	            int sgn = 1;
	            if (c == '-')
	            {
	                sgn = -1;
	                c = read();
	            }
	            int res = 0;
	            do
	            {
	                if (c < '0' || c > '9')
	                    throw new InputMismatchException();
	                res *= 10;
	                res += c - '0';
	                c = read();
	            } while (!isSpaceChar(c));
	            return res * sgn;
	        }

	        public String readString()
	        {
	            int c = read();
	            while (isSpaceChar(c))
	                c = read();
	            StringBuilder res = new StringBuilder();
	            do
	            {
	                res.appendCodePoint(c);
	                c = read();
	            } while (!isSpaceChar(c));
	            return res.toString();
	        }
	        public double readDouble() {
	            int c = read();
	            while (isSpaceChar(c))
	                c = read();
	            int sgn = 1;
	            if (c == '-') {
	                sgn = -1;
	                c = read();
	            }
	            double res = 0;
	            while (!isSpaceChar(c) && c != '.') {
	                if (c == 'e' || c == 'E')
	                    return res * Math.pow(10, readInt());
	                if (c < '0' || c > '9')
	                    throw new InputMismatchException();
	                res *= 10;
	                res += c - '0';
	                c = read();
	            }
	            if (c == '.') {
	                c = read();
	                double m = 1;
	                while (!isSpaceChar(c)) {
	                    if (c == 'e' || c == 'E')
	                        return res * Math.pow(10, readInt());
	                    if (c < '0' || c > '9')
	                        throw new InputMismatchException();
	                    m /= 10;
	                    res += (c - '0') * m;
	                    c = read();
	                }
	            }
	            return res * sgn;
	        }
	        public long readLong() {
	            int c = read();
	            while (isSpaceChar(c))
	                c = read();
	            int sgn = 1;
	            if (c == '-') {
	                sgn = -1;
	                c = read();
	            }
	            long res = 0;
	            do {
	                if (c < '0' || c > '9')
	                    throw new InputMismatchException();
	                res *= 10;
	                res += c - '0';
	                c = read();
	            } while (!isSpaceChar(c));
	            return res * sgn;
	        }
	        public boolean isSpaceChar(int c)
	        {
	            if (filter != null)
	                return filter.isSpaceChar(c);
	            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	        }

	        public String next()
	        {
	            return readString();
	        }

	        public interface SpaceCharFilter
	        {
	            public boolean isSpaceChar(int ch);
	        }
	    }

	    private 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 print(Object... objects)
	        {
	            for (int i = 0; i < objects.length; i++)
	            {
	                if (i != 0)
	                    writer.print(' ');
	                writer.print(objects[i]);
	            }
	        }

	        public void println(Object... objects)
	        {
	            print(objects);
	            writer.println();
	        }

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

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

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static final class TaskC {
        private static final int MODULO = 1_000_000_000 + 7;

        public void solve(int __, InputReader in, PrintWriter out) {
            long qty = in.nextLong();
            long months = in.nextLong();
            if (qty == 0) {
                out.println(0);
                return;
            }
            qty %= MODULO;
            long pow = pow(2, months + 1);
            qty = (qty * pow) % MODULO;
            long sub = (pow - 2 + MODULO) % MODULO * pow(2, MODULO - 2) % MODULO;
            qty = (qty - sub + MODULO) % MODULO;
            out.println(qty);
        }

        private long pow(long base, long power) {
            long result = 1;
            while (power > 0) {
                if ((power & 1) != 0) {
                    result = (result * base) % MODULO;
                }
                base = (base * base) % MODULO;
                power >>>= 1;
            }
            return result;
        }

    }

    static class InputReader {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(readLine());
            }
            return tokenizer.nextToken();
        }

        public String readLine() {
            String line;
            try {
                line = reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return line;
        }

    }
}


import java.util.*;
import java.io.*;
import java.math.BigInteger;

public class C
{

    static int mod = (int) (1e9+7);
    static InputReader in;
    static PrintWriter out;

    public static void main(String[] args)
    {
        in = new InputReader(System.in);
        out = new PrintWriter(System.out);

        long x = in.nextLong();
        long k = in.nextLong();

        if(x == 0){
            out.println(0);
        }
        else{

        long mul = pow(2, k + 1, mod);
        x %= mod;
        mul = (mul * x) % mod;
        long sub = pow(2, k, mod);
        sub = (sub - 1 + mod) % mod;
        mul = (mul - sub + mod) % mod;
        out.println(mul);
        }

        out.close();
    }

    static class Pair implements Comparable<Pair>
    {

        int x,y;
        int i;

        Pair (int x,int y)
        {
                this.x = x;
                this.y = y;
        }

        Pair (int x,int y, int i)
        {
                this.x = x;
                this.y = y;
                this.i = i;
        }

        public int compareTo(Pair o)
        {
            return Integer.compare(this.x, o.x);
        }

        public boolean equals(Object o)
        {
            if (o instanceof Pair)
            {
                Pair p = (Pair)o;
                return p.x == x && p.y==y;
            }
            return false;
        }

        @Override
        public String toString()
        {
            return x + " "+ y + " "+i;
        }

        /*public int hashCode()
        {
            return new Long(x).hashCode() * 31 + new Long(y).hashCode();
        }*/

    }

    static String rev(String s){
        StringBuilder sb=new StringBuilder(s);
        sb.reverse();
        return sb.toString();
    }

    static long gcd(long x,long y)
    {
        if(y==0)
                return x;
        else
                return gcd(y,x%y);
    }

    static int gcd(int x,int y)
    {
        if(y==0)
                return x;
        else
                return gcd(y,x%y);
    }

    static long pow(long n,long p,long m)
    {
         long  result = 1;
          if(p==0){
            return 1;
          }

        while(p!=0)
        {
            if(p%2==1)
                result *= n;
            if(result >= m)
               result %= m;
            p >>=1;
            n*=n;
            if(n >= m)
                n%=m;
        }

        return result;
    }

    static long pow(long n,long p)
    {
        long  result = 1;
          if(p==0)
            return 1;

        while(p!=0)
        {
            if(p%2==1)
                result *= n;
            p >>=1;
            n*=n;
        }
        return result;
    }

    static void debug(Object... o)
    {
            System.out.println(Arrays.deepToString(o));
    }

    static class InputReader
    {

        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream)
        {
                this.stream = stream;
        }

        public int snext()
        {
                if (snumChars == -1)
                        throw new InputMismatchException();
                if (curChar >= snumChars)
                {
                        curChar = 0;
                        try
                        {
                                snumChars = stream.read(buf);
                        } catch (IOException e)
                        {
                                throw new InputMismatchException();
                        }
                        if (snumChars <= 0)
                                return -1;
                }
                return buf[curChar++];
        }

        public int nextInt()
        {
                int c = snext();
                while (isSpaceChar(c))
                {
                        c = snext();
                }
                int sgn = 1;
                if (c == '-')
                {
                        sgn = -1;
                        c = snext();
                }
                int res = 0;
                do
                {
                        if (c < '0' || c > '9')
                                throw new InputMismatchException();
                        res *= 10;
                        res += c - '0';
                        c = snext();
                } while (!isSpaceChar(c));
                return res * sgn;
        }

        public long nextLong()
        {
                int c = snext();
                while (isSpaceChar(c))
                {
                        c = snext();
                }
                int sgn = 1;
                if (c == '-')
                {
                        sgn = -1;
                        c = snext();
                }
                long res = 0;
                do
                {
                        if (c < '0' || c > '9')
                                throw new InputMismatchException();
                        res *= 10;
                        res += c - '0';
                        c = snext();
                } while (!isSpaceChar(c));
                return res * sgn;
        }

        public int[] nextIntArray(int n)
        {
                int a[] = new int[n];
                for (int i = 0; i < n; i++)
                {
                        a[i] = nextInt();
                }
                return a;
        }

        public long[] nextLongArray(int n)
        {
                long a[] = new long[n];
                for (int i = 0; i < n; i++)
                {
                        a[i] = nextLong();
                }
                return a;
        }

        public String readString()
        {
                int c = snext();
                while (isSpaceChar(c))
                {
                        c = snext();
                }
                StringBuilder res = new StringBuilder();
                do
                {
                        res.appendCodePoint(c);
                        c = snext();
                } while (!isSpaceChar(c));
                return res.toString();
        }

        public String nextLine()
        {
                int c = snext();
                while (isSpaceChar(c))
                        c = snext();
                StringBuilder res = new StringBuilder();
                do
                {
                        res.appendCodePoint(c);
                        c = snext();
                } while (!isEndOfLine(c));
                return res.toString();
        }

        public boolean isSpaceChar(int c)
        {
                if (filter != null)
                        return filter.isSpaceChar(c);
                return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c)
        {
                return c == '\n' || c == '\r' || c == -1;
        }

        public interface SpaceCharFilter
        {
                public boolean isSpaceChar(int ch);
        }

    }
}


//package round489;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class C {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve()
	{
		int[][] M = {
				{2, mod-1},
				{0, 1}
		};
		long n = nl();
		if(n == 0){
			out.println(0);
			return;
		}

		n = n*2%mod;
		long K = nl();
		int[] v = new int[]{(int)n, 1};
		out.println(pow(M, v, K)[0]);
	}

	///////// begin
	public static final int mod = 1000000007;
	public static final long m2 = (long)mod*mod;
	public static final long BIG = 8L*m2;

	// A^e*v
	public static int[] pow(int[][] A, int[] v, long e)
	{
		for(int i = 0;i < v.length;i++){
			if(v[i] >= mod)v[i] %= mod;
		}
		int[][] MUL = A;
		for(;e > 0;e>>>=1) {
			if((e&1)==1)v = mul(MUL, v);
			MUL = p2(MUL);
		}
		return v;
	}

	// int matrix*int vector
	public static int[] mul(int[][] A, int[] v)
	{
		int m = A.length;
		int n = v.length;
		int[] w = new int[m];
		for(int i = 0;i < m;i++){
			long sum = 0;
			for(int k = 0;k < n;k++){
				sum += (long)A[i][k] * v[k];
				if(sum >= BIG)sum -= BIG;
			}
			w[i] = (int)(sum % mod);
		}
		return w;
	}

	// int matrix^2 (be careful about negative value)
	public static int[][] p2(int[][] A)
	{
		int n = A.length;
		int[][] C = new int[n][n];
		for(int i = 0;i < n;i++){
			long[] sum = new long[n];
			for(int k = 0;k < n;k++){
				for(int j = 0;j < n;j++){
					sum[j] += (long)A[i][k] * A[k][j];
					if(sum[j] >= BIG)sum[j] -= BIG;
				}
			}
			for(int j = 0;j < n;j++){
				C[i][j] = (int)(sum[j] % mod);
			}
		}
		return C;
	}

	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception { new C().run(); }

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}


import java.util.Scanner;

public class Main {

	public static long power(long a, long b, long c){
		if(b == 0){
			return 1;
		}
		a %= c;
		if(b % 2 == 0){
			return power((a % c * a % c) % c, b / 2, c);
		}else{
			return (a % c * power((a % c * a % c) % c, b / 2, c) % c) % c;
		}
	}

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		long x = s.nextLong(), k = s.nextLong() + 1, mod = (long)Math.pow(10, 9) + 7;
		long ans;
		if(x == 0){
			System.out.println(0);
			return;
		}
//		if(x != 0){
			ans = ((power(2, k % (mod - 1), mod) % mod) * (x % mod)) % mod;
	/*	}else{
			ans = 0;
		}
		*/ans = (ans - power(2, (k - 1) % (mod - 1), mod) % mod + 2 * mod) % mod;
		System.out.println((ans + 1) % mod);

	}

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class CNastyaAndAWardrobe {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long x = in.nextLong(), k = in.nextLong();
            if (x != 0) {
                long m = (int) 1e9 + 7;
                x = x % m;
                long res = in.fastPowerMod(2, k, m);
                long res1 = (2 * res) % m;
                long ans = ((res1 * x) % m - (res - 1) % m) % m;
                ans = (ans + m) % m;
                out.println(ans);
            } else {
                out.println(0);
            }
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public long fastPowerMod(long x, long y, long m) {
            long res = 1;
            x = x % m;
            while (y > 0) {
                if ((y & 1) == 1) {
                    res = (x * res) % m;
                }
                x = (x * x) % m;
                y = y >> 1;
            }
            return res % m;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.math.BigInteger;
import java.util.*;
import java.io.*;

public class Contest {

	public static void main(String[] args)throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] s=br.readLine().split(" ");
		BigInteger x = new BigInteger(s[0]);
		BigInteger k = new BigInteger(s[1]);

		BigInteger mod = new BigInteger(String.valueOf((int) (Math.pow(10, 9) + 7)));

		BigInteger two = new BigInteger("2");
		BigInteger interm = two.modPow(k, mod);

		BigInteger res = interm.multiply(two.multiply(x).subtract(BigInteger.ONE)).add(BigInteger.ONE).mod(mod);

		if(x.equals(BigInteger.ZERO)) {
			System.out.println("0");
			return;
		}
		System.out.println(res);
	}

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long MOD = MathExtentions.DEFAULT_MOD;
            long x = in.NextLong();
            long k = in.NextLong();
            if (x == 0) {
                out.println(0);
                return;
            }
            x %= MOD;
            long res = x * MathExtentions.powerMod(2, k + 1, MOD);
            res %= MOD;
            res -= MathExtentions.powerMod(2, k, MOD) - 1;
            res %= MOD;
            while (res < 0) res += MOD;
            while (res >= MOD) res -= MOD;
            out.println(res);

        }

    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine(), " \t\n\r\f,");
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public long NextLong() {
            return Long.parseLong(next());
        }

    }

    static class MathExtentions {
        public static final long DEFAULT_MOD = 1_000_000_007;

        public static long powerMod(final long x, final long y, final long m) {
            if (y == 0)
                return 1;

            long p = powerMod(x, y / 2, m) % m;
            p = (p * p) % m;

            if (y % 2 == 0)
                return p;
            else
                return (x * p) % m;
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskC {
        int MOD = 1000000007;

        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            long x = in.nextLong();
            long k = in.nextLong();
            if (x == 0) {
                out.print(0);
                return;
            }
            long b = fast_expo(2, k);
            long a = (b * 2) % MOD;

            long u = ((x % MOD) * a) % MOD;
            long v = (b - 1 + MOD) % MOD;
            out.print((u - v + MOD) % MOD);
        }

        private long fast_expo(long a, long b) {
            long res = 1L;
            a = a % MOD;
            while (b > 0) {
                if ((b & 1) != 0) {
                    res = (res * a) % MOD;
                }
                b = b >> 1;
                a = (a * a) % MOD;
            }
            return res % MOD;
        }

    }

    static class FastScanner {
        private BufferedReader bufferedReader;
        private StringTokenizer stringTokenizer;

        public FastScanner(InputStream inputStream) {
            bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String next() {
            while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class TaskC {
        long mod = (long) 1e9 + 7;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long x = in.nextLong();
            long k = in.nextLong();
            if (x == 0) {
                out.print(0);
                return;
            }
            long n = pow(2, k);
            long l = (n * ((x % mod)) % mod);
            l = l % mod;
            long ans = 2 * l - n + 1;
            ans = ans % mod;
            if (ans < 0)
                ans += mod;
            out.print(ans);
        }

        long pow(long a, long val) {
            if (val == 0) {
                return 1;
            }
            if (val % 2 == 0) {
                long ans = pow(a, val / 2);
                return (ans * ans) % mod;
            }
            return ((a % mod) * (pow(a, val - 1))) % mod;
        }

    }

    static class InputReader {
        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar;
        private int snumChars;

        public InputReader(InputStream st) {
            this.stream = st;
        }

        public int read() {
            //*-*------clare------
//remeber while comparing 2 non primitive data type not to use ==
//remember Arrays.sort for primitive data has worst time case complexity of 0(n^2) bcoz it uses quick sort
//again silly mistakes ,yr kb tk krta rhega ye mistakes
//try to write simple codes ,break it into simple things
//knowledge>rating
        /*
        public class Main
        implements Runnable{
    public static void main(String[] args) {
        new Thread(null,new Main(),"Main",1<<26).start();

    }
    public void run() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();//chenge the name of task
        solver.solve(1, in, out);
        out.close();
    }
         */

            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;

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

    static class C489 {
        int mod = 1000000007;

        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            long x = in.scanLong();
            long k = in.scanLong();
            if (x == 0) {
                out.println(0);
                return;
            }
            long p = CodeX.power(2, k, mod);
            long ans = (2 * p * (x % mod)) % mod;
            ans = (ans + 1) % mod;
            ans = (ans - p + mod) % mod;
            out.println(ans);
        }

    }

    static class CodeX {
        public static long power(long x, long y, long p) {
            long res = 1;
            x = x % p;
            while (y > 0) {
                if ((y & 1) != 0)
                    res = (res * x) % p;
                y = y >> 1;
                x = (x * x) % p;
            }
            return res;
        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int INDEX;
        private BufferedInputStream in;
        private int TOTAL;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (INDEX >= TOTAL) {
                INDEX = 0;
                try {
                    TOTAL = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (TOTAL <= 0) return -1;
            }
            return buf[INDEX++];
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

        public long scanLong() {
            long I = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    I *= 10;
                    I += n - '0';
                    n = scan();
                }
            }
            return neg * I;
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

  static class TaskC {
    static final long MODULO = (int) (1e9 + 7);

    public void solve(int testNumber, Scanner in, PrintWriter out) {
      long x = in.nextLong();
      long k = in.nextLong();

      if (x == 0) {
        out.println(0);
      } else {
        long e = modPow(2, k, MODULO);
        long y = 2 * x - 1;
        long w = ((e % MODULO) * (y % MODULO)) % MODULO;
        long z = (w + 1) % MODULO;
        out.println(z);
      }
    }

    private long modPow(long a, long b, long m) {
      if (b == 0) return 1 % m;
      if (b == 1) return a % m;
      long res = modPow(a, b / 2, m);
      res = (res * res) % m;
      if (b % 2 == 1) res = (res * a) % m;
      return res;
    }
  }
}


import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        new Solver().run(1);
    }
}

class Solver {

    private BufferedReader reader = null;
    private StringTokenizer st = null;

    private static final long MOD = (long)1e9 + 7;
    private long x, k;

    public void run(int inputType) throws Exception {
        if (inputType == 0)
            reader = new BufferedReader(new FileReader("input.txt"));
        else
            reader = new BufferedReader(new InputStreamReader(System.in));

        st = new StringTokenizer(reader.readLine());
        x = Long.parseLong(st.nextToken());
        k = Long.parseLong(st.nextToken());

        if (x == 0) {
            System.out.println(0);
            return;
        }

        long pow = binpow(2, k);
        long m = (2 * x) % MOD;

        m = (m - 1 < 0) ? MOD - 1 : m - 1;

        m = (m * pow) % MOD;
        m = (m + 1) % MOD;

        System.out.println(m);

        reader.close();
    }

    long binpow(long v, long p) {
        long res = 1L;
        while(p > 0) {

            if ((p & 1) > 0)
                res = (res * v) % MOD;

            v = (v * v) % MOD;
            p /= 2;
        }

        return res;
    }
}


import java.math.BigInteger;
import java.util.Scanner;

public class TaskC {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		BigInteger x = new BigInteger(sc.next());
		BigInteger k = new BigInteger(sc.next());

		BigInteger mod = new BigInteger(String.valueOf((int) (Math.pow(10, 9) + 7)));

		BigInteger two = new BigInteger("2");
		BigInteger interm = two.modPow(k, mod);

		BigInteger res = interm.multiply(x).add(interm.multiply(x)).subtract(interm).add(BigInteger.ONE).mod(mod);

		if(x.equals(BigInteger.ZERO)) {
			System.out.println("0");
			return;
		}
		System.out.println(res);
	}

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class Nas {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            long x = in.nextLong();
            if (x == 0) {
                out.println(0);
                return;
            }
            BigInteger n1 = BigInteger.valueOf(x);
            BigInteger n2 = BigInteger.valueOf(in.nextLong());
            BigInteger mod = BigInteger.valueOf(1000000007);
            BigInteger a = BigInteger.valueOf(2).modPow(n2.add(BigInteger.ONE), mod);
            a = a.multiply(n1);
            a = a.mod(mod);
            BigInteger b = BigInteger.valueOf(2).modPow(n2, mod).subtract(BigInteger.ONE);
            a = a.subtract(b);
            a = a.add(mod);
            a = a.mod(mod);
            out.println(a);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.util.*;
import java.io.*;
import java.text.DecimalFormat;

public class Main{
    final long mod = (int)1e9+7, IINF = (long)1e19;
    final int MAX = (int)1e6+1, MX = (int)1e7+1, INF = (int)1e9;
    DecimalFormat df = new DecimalFormat("0.0000000000000");
    FastReader in;
    PrintWriter out;
    static boolean multipleTC = false, memory = false;

    public static void main(String[] args) throws Exception{
        if(memory)new Thread(null, new Runnable() {public void run(){try{new Main().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 26).start();
        else new Main().run();
    }

    void run() throws Exception{
        in = new FastReader();
        out = new PrintWriter(System.out);
        for(int i = 1, t = (multipleTC)?ni():1; i<=t; i++)solve(i);
        out.flush();
        out.close();
    }

    void solve(int TC) throws Exception{
        long x = nl(), k = nl();
        if(x==0)pn(0);
        else {
            x%=mod;
            long p = modPow(2,k);
            long b = mul((x-1+mod)%mod,p), e = mul(x,p);
            long ans = c(e)%mod;
            ans -= c(b)%mod;
            ans%=mod;
            if(ans<0)ans+=mod;
            ans = mul(ans, 2);
            ans = mul(ans, modPow(p, mod-2));
            pn(ans);
        }
    }
    long modPow(long a, long p){
        long o = 1;
        while(p>0){
            if((p&1)==1)o = mul(a,o);
            a = mul(a,a);
            p>>=1;
        }
        return o;
    }

    long mul(long a, long b){
        if(a>=mod)a%=mod;
        if(b>=mod)b%=mod;
        a*=b;
        if(a>=mod)a%=mod;
        return a;
    }

    long c(long c){
        return (c*c+c)/2;
    }

    int[] reverse(int[] a){
        int[] o = new int[a.length];
        for(int i = 0; i< a.length; i++)o[i] = a[a.length-i-1];
        return o;
    }

    int[] sort(int[] a){
        if(a.length==1)return a;
        int mid = a.length/2;
        int[] b = sort(Arrays.copyOfRange(a,0,mid)), c = sort(Arrays.copyOfRange(a,mid,a.length));
        for(int i = 0, j = 0, k = 0; i< a.length; i++){
            if(j<b.length && k<c.length){
                if(b[j]<c[k])a[i] = b[j++];
                else a[i] = c[k++];
            }else if(j<b.length)a[i] = b[j++];
            else a[i] = c[k++];
        }
        return a;
    }

    long[] sort(long[] a){
        if(a.length==1)return a;
        int mid = a.length/2;
        long[] b = sort(Arrays.copyOfRange(a,0,mid)), c = sort(Arrays.copyOfRange(a,mid,a.length));
        for(int i = 0, j = 0, k = 0; i< a.length; i++){
            if(j<b.length && k<c.length){
                if(b[j]<c[k])a[i] = b[j++];
                else a[i] = c[k++];
            }else if(j<b.length)a[i] = b[j++];
            else a[i] = c[k++];
        }
        return a;
    }

    int[] ia(int ind,int n){
        int[] out = new int[ind+n];
        for(int i = 0; i< n; i++)out[ind+i] = ni();
        return out;
    }

    long[] la(int ind, int n){
        long[] out = new long[ind+n];
        for(int i = 0; i< n; i++)out[ind+i] = nl();
        return out;
    }

    double[] da(int ind, int n){
        double[] out = new double[ind+n];
        for(int i = 0; i< n; i++)out[ind+i] = nd();
        return out;
    }

    long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
    int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}
    int bitcount(long n){return (n==0)?0:(1+bitcount(n&(n-1)));}
    void p(Object o){out.print(o);}
    void pn(Object o){out.println(o);}
    void pni(Object o){out.println(o);out.flush();}
    String n(){return in.next();}
    String nln(){return in.nextLine();}
    int ni(){return Integer.parseInt(in.next());}
    long nl(){return Long.parseLong(in.next());}
    double nd(){return Double.parseDouble(in.next());}

    class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastReader(String s) throws Exception{
            br = new BufferedReader(new FileReader(s));
        }

        String next(){
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException  e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine(){
            String str = "";
            try{
                str = br.readLine();
            }catch (IOException e){
                e.printStackTrace();
            }
            return str;
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.StringTokenizer;

public class Tester
{

    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

    static long mod = 1000000007;
    public static void main(String[] args) {

    	solveQ3();

    }

	private static void solveQ3() {
		// TODO Auto-generated method stub

		FastReader sc = new FastReader();

		long x = sc.nextLong();
		long k = sc.nextLong();

		if(x == 0) {
			System.out.println(0);
			return;
		}
		long ans = modExp(2, k);
		x = (2*x)%mod;
		x = (x - 1 + mod)%mod;
		ans = (ans*x)%mod;
		ans = (ans + 1)%mod;

		System.out.println(ans);

	}

	private static long modExp(long a, long n) {

		if(n == 0)
			return 1;
		if(n%2 == 0)
			return modExp((a*a)%mod, n/2);
		else
			return (a*modExp((a*a)%mod, n/2))%mod;

	}

	private static void solveQ2() {
		// TODO Auto-generated method stub

		FastReader sc = new FastReader();
		long l = sc.nextLong();
		long r = sc.nextLong();

		long x = sc.nextLong();
		long y = sc.nextLong();

		long n = x*y;
		long count = 0;

		for(long i=l; (i<=Math.sqrt(n)) && (n/i<=r); i++) {

			if((n%i == 0) && (gcd(i, n/i)==x)) {

				if(i*i != n)
					count += 2;
				else
					count += 1;

			}

		}

		System.out.println(count);

	}

	public static long gcd(long a, long b) {

		if(b==0)
			return a;
		else
			return gcd(b, a%b);

	}

	private static void solveQ1() {
		// TODO Auto-generated method stub

		FastReader sc = new FastReader();
		int n = sc.nextInt();

		HashSet<Integer> hs = new HashSet<Integer>();
		for(int i=0; i<n; i++) {
			int x = sc.nextInt();
			if(x != 0) {
				hs.add(x);
			}
		}

		System.out.println(hs.size());

	}
}


//package pack;

import java.util.*;

public class first
{
	public static long power(long x, long y, long p)
    {
        long res = 1;
        x = x % p;
        while (y > 0)
        {	if((y & 1)==1)
                res = (res * x) % p;
            y = y >> 1;
            x = (x * x) % p;
        }
        return res;
    }

	public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		long x=sc.nextLong();
		long k=sc.nextLong();
		long mod=1000000007;
		if(k==0 || x==0)
			System.out.println((2*x)%mod);
		else
		{	long answer=1;
			answer+=(power(2,k,mod))*(((2*x)-1)%mod);
			System.out.println(answer%mod);
		}
	}
}


import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main
{

	long mod = 1000000007;

	long pow(long x,long y)
	{
		if(y==0)
			return 1;
		else if(y==1)
			return x%mod;
		else if(y%2==0)
			return pow((x*x)%mod,y/2)%mod;
		else
			return (x*pow((x*x)%mod,y/2)%mod)%mod;
	}

	void solve()
	{
		FastReader sc =new FastReader();
		long x = sc.nextLong();
		long k = sc.nextLong();

		if(x == 0) {
			System.out.println(0);
			return;
		}
		long ans = pow(2, k);
		x = (2*x)%mod;
		x = (x - 1 + mod)%mod;
		ans = (ans*x)%mod;
		ans = (ans + 1)%mod;

		System.out.println(ans);
	}

    public static void main(String[] args)
    {
        new Main().solve();
    }

    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.PrintWriter;
public class C992
{
    static class Scanner
    {
        BufferedReader br;
        StringTokenizer tk=new StringTokenizer("");
        public Scanner(InputStream is)
        {
            br=new BufferedReader(new InputStreamReader(is));
        }
        public int nextInt() throws IOException
        {
            if(tk.hasMoreTokens())
                return Integer.parseInt(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextInt();
        }
        public long nextLong() throws IOException
        {
            if(tk.hasMoreTokens())
                return Long.parseLong(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextLong();
        }
        public String next() throws IOException
        {
            if(tk.hasMoreTokens())
                return (tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return next();
        }
        public String nextLine() throws IOException
        {
            tk=new StringTokenizer("");
            return br.readLine();
        }
        public double nextDouble() throws IOException
        {
            if(tk.hasMoreTokens())
                return Double.parseDouble(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextDouble();
        }
        public char nextChar() throws IOException
        {
            if(tk.hasMoreTokens())
                return (tk.nextToken().charAt(0));
            tk=new StringTokenizer(br.readLine());
            return nextChar();
        }
        public int[] nextIntArray(int n) throws IOException
        {
            int a[]=new int[n];
            for(int i=0;i<n;i++)
                a[i]=nextInt();
            return a;
        }
        public long[] nextLongArray(int n) throws IOException
        {
            long a[]=new long[n];
            for(int i=0;i<n;i++)
                a[i]=nextLong();
            return a;
        }
        public int[] nextIntArrayOneBased(int n) throws IOException
        {
            int a[]=new int[n+1];
            for(int i=1;i<=n;i++)
                a[i]=nextInt();
            return a;
        }
        public long[] nextLongArrayOneBased(int n) throws IOException
        {
            long a[]=new long[n+1];
            for(int i=1;i<=n;i++)
                a[i]=nextLong();
            return a;
        }

    }
    static long mod=1000000007;
    static long mod_exp(long base,long exp)
    {
        long ans=1;
        base%=mod;
        while(exp>0)
        {
            if(exp%2==1)
            {
                ans*=base;
                ans%=mod;
            }
            exp/=2;
            base*=base;
            base%=mod;
        }
        return ans;
    }
    public static void main(String args[]) throws IOException
    {
        Scanner in=new Scanner(System.in);
        PrintWriter out=new PrintWriter(System.out);
        long x=in.nextLong();
        long k=in.nextLong();

        long ans=mod_exp(2,k+1);
        ans*=(x%mod);
        ans%=mod;
        ans-=mod_exp(2,k);
        ans%=mod;
        ans++;
        ans%=mod;
        if(ans<0)
            ans+=mod;
        if(x==0)
            ans=0;
        out.println(ans);
        out.close();
    }

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class CNastyaAndAWardrobe {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            long x = in.nextLong();
            long k = in.nextLong();
            if (x == 0) {
                out.println(0);
            } else {
                long mod = (long) (1e9 + 7);
                long ans = (((((2 * x - 1) % mod)) * power(2, k, mod)) % mod) + 1;
                ans %= mod;
                out.println(ans);
            }

        }

        long power(long x, long y, long p) {
            long res = 1;
            x = x % p;
            while (y > 0) {
                if ((y & 1) > 0)
                    res = (res * x) % p;
                y = y >> 1;
                x = (x * x) % p;
            }
            return res;
        }

    }

    static class FastScanner {
        private final InputStream stream;
        private final byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public FastScanner(InputStream stream) {
            this.stream = stream;
        }

        int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

    }
}


//package com.company;

import java.io.*;
import java.util.*;
import java.math.*;

public class Main {
    static long TIME_START, TIME_END;
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
//        Scanner sc = new Scanner(new FileInputStream("Test.in"));
        PrintWriter pw = new PrintWriter(System.out);
//        PrintWriter pw = new PrintWriter(new FileOutputStream("Test.out"));
//        PrintWriter pw = new PrintWriter(new FileOutputStream("Test.in"));
        Runtime runtime = Runtime.getRuntime();
        long usedMemoryBefore = runtime.totalMemory() - runtime.freeMemory();
        TIME_START = System.currentTimeMillis();
        Task t = new Task();
        t.solve(sc, pw);
        TIME_END = System.currentTimeMillis();
        long usedMemoryAfter = runtime.totalMemory() - runtime.freeMemory();
        pw.close();
        System.out.println("Memory increased:" + (usedMemoryAfter-usedMemoryBefore) / 1000000 );
        System.out.println("Time used: " + (TIME_END - TIME_START) + ".");
    }

    public static class Task {
        int mod = 1_000_000_007;
        public long pow(long a, long b) {
            if (b == 0) return 1L;
            if (b % 2 == 0) return pow(a * a % mod, b >> 1);
            return a * pow(a * a % mod, b >> 1) % mod;
        }
        public void solve(Scanner sc, PrintWriter pw) throws IOException {
            long T = sc.nextLong();
            long k = sc.nextLong();
            if (T == 0) {
                pw.println(0);
                return;
            }
            long a1 = pow(2, k + 1);
            long a2 = pow(2, k);
            long s = a1 * (T % mod) % mod;
            long t = ((1 - a2) + mod) % mod;
            long y = (s + t) % mod;
            pw.println((y + 5L * mod) % mod);
        }

    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s){  br = new BufferedReader(new InputStreamReader(s));}

        public Scanner(FileReader s) throws FileNotFoundException {br = new BufferedReader(s);}

        public String next() throws IOException
        {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {return Integer.parseInt(next());}

        public long nextLong() throws IOException {return Long.parseLong(next());}

        public String nextLine() throws IOException {return br.readLine();}

        public double nextDouble() throws IOException { return Double.parseDouble(next()); }

        public boolean ready() throws IOException {return br.ready();}
    }
}


import java.math.*;
import java.util.*;
import java.io.*;

public class Main {
    void solve() {
        long x=nl(),k=nl();
        if(x==0) {
            pw.println(0);
            return;
        }
        long d=modpow(2,k,M);
        long ans=mul(2,d,M);
        ans=mul(ans,x,M)%M;
        ans++;
        ans%=M;
        ans=(ans-d+M)%M;

        pw.println(ans);

    }
//    long mul(long a, long b,long M)
//    {
//        return (a*1L*b)%M;
//    }
    long mul(long x, long y, long m) {
        long ans = 0;
        while (y>0) {
            if ((y & 1)>0) {
                ans += x;
                if (ans >= m) ans -= m;
            }
            x = x + x;
            if (x >= m) x -= m;
            y >>= 1;
        }
        return ans;
    }

    long modpow(long a, long b,long M)
    {
        long r=1;
        while(b>0)
        {
            if((b&1)>0) r=mul(r,a,M);
            a=mul(a,a,M);
            b>>=1;
        }
        return r;
    }

    long M=(long)1e9+7;
    InputStream is;
    PrintWriter pw;
    String INPUT = "";
    void run() throws Exception {
        is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
        pw = new PrintWriter(System.out);
        long s = System.currentTimeMillis();
        solve();
        pw.flush();
        if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
    }

    public static void main(String[] args) throws Exception { new Main().run(); }

    private byte[] inbuf = new byte[1024];
    public int lenbuf = 0, ptrbuf = 0;

    private int readByte() {
        if(lenbuf == -1)throw new InputMismatchException();
        if(ptrbuf >= lenbuf){
            ptrbuf = 0;
            try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
            if(lenbuf <= 0)return -1;
        }
        return inbuf[ptrbuf++];
    }

    private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
    private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

    private double nd() { return Double.parseDouble(ns()); }
    private char nc() { return (char)skip(); }

    private String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n) {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while(p < n && !(isSpaceChar(b))){
            buf[p++] = (char)b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m) {
        char[][] map = new char[n][];
        for(int i = 0;i < n;i++)map[i] = ns(m);
        return map;
    }

    private int[] na(int n) {
        int[] a = new int[n];
        for(int i = 0;i < n;i++)a[i] = ni();
        return a;
    }

    private int ni() {
        int num = 0, b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }

        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private long nl() {
        long num = 0;
        int b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }

        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); }
}