Since Grisha behaved well last year, at New Year's Eve he was visited by Ded Moroz who brought an enormous bag of gifts with him! The bag contains n sweet candies from the good ol' bakery, each labeled from 1 to n corresponding to its tastiness. No two candies have the same tastiness.

The choice of candies has a direct effect on Grisha's happiness. One can assume that he should take the tastiest ones — but no, the holiday magic turns things upside down. It is the xor-sum of tastinesses that matters, not the ordinary sum!

A xor-sum of a sequence of integers a1, a2, ..., am is defined as the bitwise XOR of all its elements: <image>, here <image> denotes the bitwise XOR operation; more about bitwise XOR can be found [here.](https://en.wikipedia.org/wiki/Bitwise_operation#XOR)

Ded Moroz warned Grisha he has more houses to visit, so Grisha can take no more than k candies from the bag. Help Grisha determine the largest xor-sum (largest xor-sum means maximum happiness!) he can obtain.

Input

The sole string contains two integers n and k (1 ≤ k ≤ n ≤ 1018).

Output

Output one number — the largest possible xor-sum.

Examples

Input

4 3


Output

7


Input

6 6


Output

7

Note

In the first sample case, one optimal answer is 1, 2 and 4, giving the xor-sum of 7.

In the second sample case, one can, for example, take all six candies and obtain the xor-sum of 7.
import java.util.Scanner; 
import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;
 
public class M
{	
	//public static int prime[] = new int[5000007];
 
	public static void main(String args[])
	{	
		Scanner In = new Scanner(System.in);
		PrintWriter w = new PrintWriter(System.out);
		
		long n = In.nextLong();
        long k = In.nextLong();
        
        if(k == 1)
            w.println(n);
        else
        {
            long ans = 1;
            
            while(n != 0)
            {
                n = n >> 1;
                ans = ans << 1;
            }
            
            w.println(ans-1);
        }  

		w.close();
	}
	
	/*public static long pow(int a , int b)
	{
		long ans = 1;
		
		while(b > 0)
		{
			if(b%2 == 1)
			{
				ans = (ans*a);
				
				if(ans >= Long.MAX_VALUE)
				    return Long.MAX_VALUE;
			}
			
			a = a*a;
			
			if(a >= Long.MAX_VALUE)
				    return Long.MAX_VALUE;
			
			b = b/2;
		}
		
		return ans;
	}
	
	public static void sieve()
	{
		Arrays.fill(prime , 1);
		
		prime[0] = 0;
		prime[1] = 1;
		
		for(int i = 2 ; i*i < 5000007 ; i++)
		{
			if(prime[i] == 1)
			{
				for(int j = i+i ; j < 5000007 ; j+=i)
				{
					if(prime[j] == 1)
						prime[j] = i;
				}
			}
		}
	}
	
	static class Trip
	{
		int l;
		int r;
		int c;
		
		public Trip(int l , int r , int c)
		{
			this.l = l;
			this.r = r;
			this.c = c;
		}
	}
	
	public static int GCD(int a , int b)
	{
		if(b == 0)
			return a;
		else
			return GCD(b , a%b);
	}*/
 
	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 String nextLine()
		{
			BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
			String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
		}
		public int nextInt()
		{
			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 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 double nextDouble() 
		{
			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, nextInt());
				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, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			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 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);
		}
	}
	
	static class Node implements Comparable<Node>
	{
		int floor;
		int time;
		
		public Node(int floor  , int time)
		{
			this.floor = floor;
			this.time = time;
		}
		
		public int compareTo(Node node)
		{
			if(floor < node.floor)
				return 1;
			
			if(floor > node.floor)
				return -1;
			
			if(time <= node.time)
				return 1;
			
			return -1;
		}
	}
}

class Checker implements Comparator
{
	public int compare(Object a , Object b)
	{
		String as = (String)a;
		String bs = (String)b;
		
		int ab = Integer.parseInt(as+bs);
		int ba = Integer.parseInt(bs+as);
		
		if (ab < ba)
			return  1;
		else
			return -1;
	}
}