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.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
 
public class Main
{
    
    static class InputReader {

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

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

		public int read() {
			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 = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				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 {
				res *= 10;
				res += c - '0';
				c = read();
			} 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 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 String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

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

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

	}
	



    public static void main(String[] args)
    {
        
        InputReader sc = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        /*
        HashMap<String,Integer> hm = new HashMap<>();
        hm.put("q",1);hm.put("w",2);hm.put("e",3);hm.put("r",4);hm.put("t",5);
        hm.put("y",6);hm.put("u",7);hm.put("i",8);hm.put("o",9);hm.put("p",10);
        hm.put("a",11);hm.put("s",12);hm.put("d",13);hm.put("f",14);hm.put("g",15);
        hm.put("h",16);hm.put("j",17);hm.put("k",18);hm.put("l",19);hm.put(";",20);
        hm.put("z",21);hm.put("x",22);hm.put("c",23);hm.put("v",24);hm.put("b",25);
        hm.put("n",26);hm.put("m",27);hm.put(",",28);hm.put(".",29);hm.put("/",30);
        String x = sc.readString();    
        String s = sc.readString();
        for(int i=0;i<s.length();i++)
        {
            if(x.equals("L"))
            {
            w.print(hm.get(hm.getKey(s.substring(i,i+1))+1));
    }
    else{
            w.print(hm.get(hm.getKey(s.substring(i,i+1))-1));
            
    }   
        }
        */
       
       long l = sc.nextLong();
       long k = sc.nextLong();
       long p = Long.highestOneBit(l);
       
       if(k >= 2)
       {
           w.println(p*2 - 1);
           
       }
       else
       w.println(l);
    
       
    
        w.close();
        

        
    } 

   static class Student
    {
        int start;
        int end;
        int index;
        Student(int start,int end,int index)
        {
            this.start = start;
            this.end = end;
            this.index = index;
            
        }
        
    }
    
    
    public static int ip(String s){
		return Integer.parseInt(s);
	}
	
}