import java.util.*;

public class bitch {
    public static void main(String[]args) {

        Scanner k=new Scanner(System.in);
        int n=k.nextInt();
        int m=k.nextInt();
        System.out.println(2*(m-n-1));



    }

}