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.*;
import java.io.*;

public class B {
	public static void main(String[] args) throws Exception{
		InputReader in = new InputReader(System.in);	
		
		long n = in.nextLong();
		long k = in.nextLong();
		
		if(k==1) {
			System.out.println(n);
		} else {
			boolean flag = false;
			
			long rs = 0;
			for(int i=63;i>=0;i--) {
				if(flag) {
					rs+=(1L<<i);
					continue;
				} else if((n&(1L<<i))!=0) {
					flag = true;
					rs+=(1L<<i);
				}
			}
			System.out.println(rs);
		}
	}
	
	public static void MergeSort(int[] A, int lo, int hi) {
		if(lo<hi) {
			int mid = (lo+hi)/2;
			MergeSort(A,lo,mid);
			MergeSort(A,mid+1,hi);
			Merge(A,lo,mid,hi);
		}
	}
	
	public static void Merge(int[] A, int lo, int mid, int hi) {
		int p = lo, q = mid+1;
		
		int[] Arr = new int[hi-lo+1];
		int k = 0;
		
		for(int i=lo;i<=hi;i++) {
			if(p>mid) {
				Arr[k++] = A[q++];
			} else if(q>hi) {
				Arr[k++] = A[p++];
			} else if(A[p]<A[q]) {
				Arr[k++] = A[p++];
			} else {
				Arr[k++] = A[q++];
			}
		}
		
		for(int i=0;i<k;i++) {
			A[lo++] = Arr[i];
		}
	}
	
	public static void QuickSort(int[] A, int lo, int hi) {
		if(lo<hi) {
			int index = partition(A,lo, hi);
			QuickSort(A, lo, index-1);
			QuickSort(A, index+1, hi);
		}
	}
	
	public static int partition(int[] A, int lo, int hi) {
		int pivot = A[hi];
		
		int i = lo-1;
		
		for(int j=lo;j<hi;j++) {
			if(A[j]<=pivot) {
				i++;
				swap(A,i,j);
			}
		}
		swap(A,i+1,hi);
		return i+1;
	}
	
	public static void swap(int[] A, int i, int j) {
		int temp = A[i];
		A[i] = A[j];
		A[j] = temp;
	}
	
	//Search for A particular Key in a sorted array
	public static int binarySearch(int[] A, int key, int lo, int hi) {
		while(lo<=hi) {
			int mid = (lo+hi)/2;
			if(A[mid]==key) {
				return mid;
			} else if(A[mid]>key) {
				hi = mid-1;
			} else {
				lo = mid+1;
			}
		}
		return -1;
	}
	
	public static int upperBound(int[] A, int key, int lo, int hi) {
		while(lo<=hi) {
			int mid = (lo+hi)/2;
			if(A[mid]>key && (mid==1 || A[mid-1]<=key)) {
				return mid;
			} else if(A[mid]>key) {
				hi = mid-1;
			} else {
				lo = mid+1;
			}
		}
		return -1;
	}
	
	public static int lowerBound(int[] A, int key, int lo, int hi) {
		while(lo<=hi) {
			int mid = (lo+hi)/2;
			if(A[mid]>=key && (mid==1 || A[mid-1]<key)) {
				return mid;
			} else if(A[mid]>=key) {
				hi = mid-1;
			} else {
				lo = mid+1;
			}
		}
		return -1;
	}
	
	public static int power(int x, int n) {
		if(n==0) {
			return 1;
		}
		if(n==1) {
			return x;
		}
		int ret = power(x,n/2);
		int val = ret*ret;
		if(n%2==1) {
			val*=x;
		}
		return val;
	}
	
	public static int[][] sparseTable(int[] A, int n) {
		int logN = (int)(Math.log(n)/Math.log(2));
		
		int[][] M = new int[n][logN+1];
		
		for(int i=0;i<n;i++) {
			M[i][0] = i;
		}
		
		for(int j=1;(1<<j)<=n;j++) {
			for(int i=0;i+(1<<j)-1<n;i++) {
				if(A[M[i][j-1]]<A[M[i+(1<<(j-1))][j-1]]) {
					M[i][j] = M[i][j-1];
				} else {
					M[i][j] = M[i+(1<<(j-1))][j-1];
				}
			}
		}
		
		return M;
	}
	
	public static void initialize(int[] A, int[] segmentTree, int start, int end, int index) {
		if(start==end) {
			segmentTree[index] = start;
			return;
		}
		
		int mid = (start+end)/2;
		
		initialize(A,segmentTree, start, mid, index*2+1);
		initialize(A,segmentTree, mid+1, end, index*2+2);
		
		if(A[segmentTree[index*2+1]]<=A[segmentTree[index*2+2]]) {
			segmentTree[index] = segmentTree[index*2+1];
		} else {
			segmentTree[index] = segmentTree[index*2+2];
		}
	}
	
	public static void update(int[] A, int[] segmentTree, int start, int end, int index, int pos, int val) {
		if(start==end) {
			A[segmentTree[index]] = val;
			return;
		}
		
		int mid = (start+end)/2;
		
		if(pos<=mid) {
			update(A,segmentTree,start,mid,index*2+1,pos,val);
		} else {
			update(A,segmentTree,mid+1,end,index*2+2,pos,val);
		}
		
		if(A[segmentTree[index*2+1]]<=A[segmentTree[index*2+2]]) {
			segmentTree[index] = segmentTree[index*2+1];
		} else {
			segmentTree[index] = segmentTree[index*2+2];
		}
	}
	
	public static int query(int[] A, int[] segmentTree, int start, int end, int index, int rangeStart, int rangeEnd) {
		if(rangeStart>end || rangeEnd<start) {
			return -1;
		}
		if(rangeStart<=start && rangeEnd>=end) {
			return segmentTree[index];
		}
		
		int mid = (start+end)/2;
		int val1 = query(A,segmentTree, start, mid, index*2+1, rangeStart, rangeEnd);
		int val2 = query(A,segmentTree, mid+1, end, index*2+2, rangeStart, rangeEnd);
		
		if(val1==-1) {
			return val2;
		} 
		if(val2==-1) {
			return val1;
		}
		if(A[val1]<=A[val2]) {
			return val1;
		}
		return val2;
	}
	
	public static void constructSegmentTree(int[] A, int n) {
		int x = (int)Math.ceil(Math.log(n)/Math.log(2));
		
		int size = (int)Math.pow(2,x+1)-1;
		
		int[] segmentTree = new int[size+1];
		initialize(A,segmentTree,0,n-1,0);
		//update
		update(A,segmentTree,0,n-1,0,4,10);
		
		//query
		int ret = query(A,segmentTree,0,n-1,0,9,9);
	}
	
	//Z Algorithm
	public static int[] createLCPArray(String str) {
		int len = str.length();
		int[] lcp = new int[len];
		int L=0,R=0;
		lcp[0] = 0;
		
		for(int i=1;i<len;i++) {
			if(i>R) {
				L=R=i;
				while(R<len && str.charAt(R)==str.charAt(R-L)) {
					R++;
				}
				lcp[i] = R-L;
				R--;
			} else {
				int k = i-L;
				if(lcp[k]<R-i+1) {
					lcp[i] = lcp[k];
				} else {
					L=i;
					R++;
					while(R<len && str.charAt(R)==str.charAt(R-L)) {
						R++;
					}
					lcp[i] = R-L;
					R--;
				}
				
			}
		}
		
		return lcp;
	}
	
	public static boolean check(int N, int pos) {
		return (N&(1<<pos))!=0;
	}
	
	public static int set(int N, int pos) {
		return N|=(1<<pos);
	}
	
	public static int[] sieve(int N) {
		int[] status = new int[(N>>5)+2];
		int sqrtN = (int)Math.sqrt(N);
		for(int i=3;i<=sqrtN;i+=2) {
			if(!check(status[i>>5],i&31)) {
				for(int j=i*i;j<=N;j+=(i<<1)) {
					status[j>>5] = set(status[j>>5],j&31);
				}
			}
		}
		
		int[] prime = new int[N];
		int cnt=0;
		prime[cnt++]=2;
		for(int i=3;i<=N;i+=2) {
			if(!check(status[i>>5],i&31)) {
				prime[cnt++]=i;
			}
		}
		return prime;
	}
	
	public static int[][][] FibonacciGeneration(int P) {
		int[][][] A = new int[P][2][2];
		A[0][0][0] = 1;
		A[0][0][1] = 1;
		A[0][1][0] = 1;
		A[0][1][1] = 0;
		
		for(int i=1;i<P;i++) {
			A[i][0][0] = A[i-1][0][0]*A[i-1][0][0] + A[i-1][0][1]*A[i-1][1][0];
			A[i][0][1] = A[i-1][0][0]*A[i-1][0][1] + A[i-1][0][1]*A[i-1][1][1];
			A[i][1][0] = A[i-1][1][0]*A[i-1][0][0] + A[i-1][1][1]*A[i-1][1][0];
			A[i][1][1] = A[i-1][1][0]*A[i-1][0][1] + A[i-1][1][1]*A[i-1][1][1];
		}
		return A;
	}
	
	public static int[][] matrixMultiplication(int[][] A, int[][] B) {
		int ARow = A.length;
		int ACol = A[0].length;

		int BCol = B[0].length;
		
		int[][] C = new int[ARow][BCol];
		
		for(int i=0;i<ARow;i++) {
			for(int j=0;j<BCol;j++) {
				C[i][j]=0;
				for(int k=0;k<ACol;k++) {
					C[i][j] += A[i][k]*B[k][j];
				}
			}
		}
		return C;
	}
	
	
	public static void Fibonacci() {
		//Array Size
		int N = 1000000001;
		//highest 2 power which is less than N
		int P = (int)Math.ceil(Math.log(N)/Math.log(2));
		//A contains fibonacci matrix for the power of 2's
		int[][][] A = FibonacciGeneration(P);
		
		//Lth Fibonacci(T=L-1)
		int T = 6;
		int[][] rs = {{1,0},{0,1}};
		
		for(int i=P-1;i>=0;i--) {
			if((T&(1<<i))!=0) {
				rs = matrixMultiplication(rs,A[i]);
			}
		}
		
		int rslt = rs[0][0] + rs[0][1];
	}
	
	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;
		
		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream));
			tokenizer = null;
		}
		
		public String next() throws Exception {
			while(tokenizer==null || !tokenizer.hasMoreTokens()) {
				tokenizer = new StringTokenizer(reader.readLine());
			}
			return tokenizer.nextToken();
		}
		
		public String nextLine() throws Exception {
			return reader.readLine();
		}
		
		public int nextInt() throws Exception {
			return Integer.parseInt(next());
		}
		
		public long nextLong() throws Exception {
			return Long.parseLong(next());
		}
		
		public double nextDouble() throws Exception {
			return Double.parseDouble(next());
		}
	}
}
