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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import javax.management.Query;
import javax.swing.plaf.nimbus.NimbusLookAndFeel;

import java.util.PriorityQueue;
import java.util.Set;
import java.util.Stack;
import java.util.StringTokenizer;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Double.parseDouble;

public class Solution { 
 	static  int mod=1000000007;

	public static void main(String[] args) throws IOException, InterruptedException {
		PrintWriter out=new PrintWriter(System.out); 
		BufferedReader br=new  BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;
	    //reviser complement 2
		//hexadecimal
	   st=new StringTokenizer(br.readLine());
	   long n=parseLong(st.nextToken());
	   long k=parseLong(st.nextToken());
	   if(k == 1) out.println(n);
	   else out.println(Long.highestOneBit(n)*2 - 1);
	   
	 
	  
		
	    		
		
		
		
		
		
		out.close();
		
	
	
	

	}
	
	static boolean nim_game(int n){
		int[] win_pos=new int[]{2, 3, 5, 4};
		if(n > 0){
			for(int x: win_pos){
				if(x == n) return true;
			}
			if(n == 1) return false;
			if(!nim_game(n - 5)|| !nim_game(n - 3)|| !nim_game(n - 2)) return true;
		}
		return false;
	}
	static int xor_range(int n){
		if(n == 0) return 0;
		int r= n% 4;
		if(r == 0) return n;
		if(r == 1) return 1;
		if(r == 2) return n+1;
		return 0;
	}
	static void sol(int[] arr, int index, int time, int k, HashMap<Integer, Integer> map, int sum){
		if( time == k+1){ 
				if(map.containsKey(sum)) map.put(sum, map.get(sum) + 1);
				else map.put(sum, 1);
		}
		
		if(time <= k){
			for(int i=index ; i  < arr.length; ++i){
				sol(arr, i + 1 , time + 1 , k, map, sum + arr[i]);
			}
		}
	}
	
	static int combinaison(double n, double k){//c(n, k)= (k+1)/(n-k)
		double res= 1;
		for(int i= 1; i<=k; ++i){
			res *= (n-i+1)/(i);
		}
		return (int)res;
	}
	static int countmin(int a, int b, int c){
		//Given a sequence of three binary sequences A, B and C of N bits. Count the minimum bits
		//required to flip in A and B such that XOR of A and B is equal to C
		int res= a ^ b ^ c;
		int count=0;
		while(res != 0){
			++count;
			res&=res - 1;
		}
		return count;
	}
	static int countval(int n){//Given a positive integer n, find count of positive integers i such that 0 <= i <= n and n+i = n^i
		int count=0;
		while(n != 0){
			if((n & 1) == 0) ++count;
		}
		return 1<<count;
	}
	static int firstright(int x){
		
		int y=1;
		int pos=1;
		while((x&y) == 0){
			pos++;
			y<<=1;
		}
		return pos;
	}
	
	static int atob(int a, int b){
		int c= a^b;
		int count=0;
		while(c != 0){
			c&=(c-1);
			++count;
		}
		return count;
	}
	  
	
	static int setBits(int x){
		int count=0;
		if(x == 0) return 0;
		while(x != 0){
			if(x % 2 == 1){
				--x;
				++count;
			}
			x/=2;
			
		}
		return count;
	}
	static boolean isPower4(long x){
			if((x & (x-1)) != 0) return false;
			int count=0;
			while(x != 1){
				x>>=1;
				++count;
			}
			
			if(count % 2 == 0) return true;
			return false;
	
	}
	
	
	
	static long addOne(long x){// add one using bit manipulation
	    long y = 1; 
		while((x & y) != 0){
			x ^= y;
			y<<=1;
		}
		
		return x ^ y;
	}
	
	static int compute_xor_range(int n){// compute xor from 1 to n
		int r= n % 4;
		if(r== 0) return n;
		else if(r== 1) return 1;
		else if(r== 2) return n+1;
		else return 0;
				
	}
	
	static long number_combinaisons(long n){//n cardinal of set 
		//fonction return number of combinaisons
		return (1 << n) ;
	}
	
	static boolean isPoweroftwo(long x){
		//check a number is power of two 
		//we use x & (x-1) to eliminate the first set bit
		
		return (x!=0 && (x & (x-1)) == 0)?true:false;
	}
	
	static long findxor(long[] Set,long n){// this function find xor of xor's of all subsets
		//n is length of set array
		if(n >1 ) return 0;
		else return Set[0];
	}
	// pour generer un nombre entier a partir de binaire int a=0b111;
	
	static long MSB(long n){// most significant bit
		while((n&(n-1)) != 0){
			n &= n-1;
		}
		return n;
	}
	
	static long LSB(long n){
	      if(n == 0) return 0;
	      return n-(n & (n-1));
	}
	
	
	 
	
		
}




