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.*;
import java.math.*;
import java.security.KeyStore.Entry;
import java.util.*;
/* 
																yash jobanputra
																	DA-IICT
*/
public class mstkp 
{
	private static InputStream stream;
	private static byte[] buf = new byte[1024];
	private static int curChar;
	private static int numChars;
	private static SpaceCharFilter filter;
	private static PrintWriter pw;
	private static long mod = 1000000000 + 7;
	private static long mod1 = 1000000000 + 9;
	private static int MAX=1000001;
	private static int block;
	private static int count;
	private static boolean[] vis;
	private static void soln()
	{
		long n=nl();long k=nl();
		if(k==1)	pw.println(n);
		else
		{
			long r=Long.toBinaryString(n).length();
			//pw.println(r);
			r=pow(2,r);
		//	pw.println((r/2-1)==n?n:r-1);
			pw.println(r-1);
		}
		pw.close();
	}	
	private static class Pair implements Comparable<Pair>
	{
		int v,i;Pair j;
		public Pair(int a,int b)
		{
			v=a;
			i=b;
		}
		public Pair(int a,Pair b)
		{
			v=a;
			j=b;
		}
		@Override
		public int compareTo(Pair arg0) 
		{
			{
				return this.v-arg0.v;
			}
		}
	}
	
	private static long pow(long a, long b) 
	{
		if (b == 0)
			return 1;
		long p = pow(a, b / 2);
		p = (p * p);
		return (b % 2 == 0) ? p : (a * p);
	}
	private static long pow(long a, long b, long c) 
	{
		if (b == 0)
			return 1;
		long p = pow(a, b / 2, c);
		p = (p * p) % c;
		return (b % 2 == 0) ? p : (a * p) % c;
	}
	private static long gcd(long n, long l) 
	{
		if (l == 0)
			return n;
		return gcd(l, n % l);
	}

	private static long max(long a, long b)
	{
		if (a > b)
			return a;
		return b;
	}

	private static long min(long a, long b) 
	{
		if (a < b)
			return a;
		return b;
	}

	public static void main(String[] args) throws Exception
	{
		new Thread(null,new Runnable()
		{
			@Override
			public void run() 
			{
				/*try {
					InputReader(new FileInputStream("C:\\Users\\hardik\\Desktop\\C-small-1-attempt1.in"));
				} catch (FileNotFoundException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}*/
				InputReader(System.in);
				pw = new PrintWriter(System.out);
				/*try {
					pw=new PrintWriter(new FileOutputStream("C:\\Users\\hardik\\Desktop\\out.txt"));
				} catch (FileNotFoundException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}*/
				soln();
				pw.close();
			}
		},"1",1<<26).start();
	}

	public static void InputReader(InputStream stream1) 
	{
		stream = stream1;
	}

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

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

	private static 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++];
	}

	private static int ni()
	{
		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;
	}

	private static long nl() 
	{
		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;
	}
	private static double nd()
    {
        double ret = 0, div = 1;
        int c = read();
        while (c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if (neg)
            c = read();

        do 
        {
            ret = ret * 10 + c - '0';
        }
        while ((c = read()) >= '0' && c <= '9');

        if (c == '.')
        {
            while ((c = read()) >= '0' && c <= '9')
            {
                ret += (c - '0') / (div *= 10);
            }
        }

        if (neg)
            return -ret;
        return ret;
    }
	private static String nextToken() 
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do 
		{
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	private static String nli() 
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do 
		{
			res.appendCodePoint(c);
			c = read();
		} while (!isEndOfLine(c));
		return res.toString();
	}
	
	private static int[] nia(int n) 
	{
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) 
		{
			arr[i] = ni();
		}
		return arr;
	}

	private static long[] nla(int n)
	{
		long[] arr = new long[n];
		for (int i = 0; i < n; i++)
		{
			arr[i] = nl();
		}
		return arr;
	}

	private static void pa(int[] arr)
	{
		for (int i = 0; i < arr.length; i++) 
		{
			pw.print(arr[i] + " ");
		}
		pw.println();
		return;
	}

	private static void pa(long[] arr) 
	{
		for (int i = 0; i < arr.length; i++) 
		{
			pw.print(arr[i] + " ");
		}
		pw.println();
		return;
	}

	private static boolean isSpaceChar(int c) 
	{
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}
	private static char nc() 
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		char c1=(char)c;
		while(!isSpaceChar(c))
			c=read();
		return c1;
	}
	private interface SpaceCharFilter 
	{
		public boolean isSpaceChar(int ch);
	}
}