import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d = sc.nextInt();

		int tree = 0;
		int number = 0;
		for (int i=1; i<=n; i++) {
			if (i-d < 1) {
				if (i+d >= n) {
					number++;
					break;
				}
			} else if (i-d == 1) {
				tree = i+d;
				number++;
			} else {
				if (i+d == n) {
					number++;
					break;
				}
				if (i-d == tree+1) {
					tree = i+d;
					number++;
				}
				if (tree >= n) {
					break;
				}
			}
		}

		System.out.println(number);
		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d = sc.nextInt();

		int tree = 0;
		int number = 0;
		for (int i=1; i<=n; i++) {
			if (i-d < 1) {
				if (i+d >= n) {
					number++;
					break;
				}
			} else if (i-d == 1) {
				tree = i+d;
				number++;
			} else {
				if (i+d == n) {
					number++;
					break;
				}
				if (i-d == tree+1) {
					tree = i+d;
					number++;
				}
				if (tree >= n) {
					break;
				}
			}
		}

		System.out.println(number);
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d = sc.nextInt();

		int tree = 0;
		int number = 0;
		for (int i=1; i<=n; i++) {
			if (i-d < 1) {
				if (i+d >= n) {
					number++;
					break;
				}
			} else if (i-d == 1) {
				tree = i+d;
				number++;
			} else {
				if (i+d == n) {
					number++;
					break;
				}
				if (i-d == tree+1) {
					tree = i+d;
					number++;
				}
				if (tree >= n) {
					break;
				}
			}
		}

		System.out.println(number);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d = sc.nextInt();

		int tree = 0;
		int number = 0;
		for (int i=1; i<=n; i++) {
			if (i-d < 1) {
				if (i+d >= n) {
					number++;
					break;
				}
			} else if (i-d == 1) {
				tree = i+d;
				number++;
			} else {
				if (i+d == n) {
					number++;
					break;
				}
				if (i-d == tree+1) {
					tree = i+d;
					number++;
				}
				if (tree >= n) {
					break;
				}
			}
		}

		System.out.println(number);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int d = sc.nextInt(); d sc.nextInt() sc.nextInt sc int tree = 0; tree 0 int number = 0; number 0 for (int i=1; i<=n; i++) {
			if (i-d < 1) {
				if (i+d >= n) {
					number++;
					break;
				}
			} else if (i-d == 1) {
				tree = i+d;
				number++;
			} else {
				if (i+d == n) {
					number++;
					break;
				}
				if (i-d == tree+1) {
					tree = i+d;
					number++;
				}
				if (tree >= n) {
					break;
				}
			}
		} int i=1; int i=1; i 1 i<=n i n i++ i++ i {
			if (i-d < 1) {
				if (i+d >= n) {
					number++;
					break;
				}
			} else if (i-d == 1) {
				tree = i+d;
				number++;
			} else {
				if (i+d == n) {
					number++;
					break;
				}
				if (i-d == tree+1) {
					tree = i+d;
					number++;
				}
				if (tree >= n) {
					break;
				}
			}
		} {
			if (i-d < 1) {
				if (i+d >= n) {
					number++;
					break;
				}
			} else if (i-d == 1) {
				tree = i+d;
				number++;
			} else {
				if (i+d == n) {
					number++;
					break;
				}
				if (i-d == tree+1) {
					tree = i+d;
					number++;
				}
				if (tree >= n) {
					break;
				}
			}
		} if (i-d < 1) {
				if (i+d >= n) {
					number++;
					break;
				}
			} else if (i-d == 1) {
				tree = i+d;
				number++;
			} else {
				if (i+d == n) {
					number++;
					break;
				}
				if (i-d == tree+1) {
					tree = i+d;
					number++;
				}
				if (tree >= n) {
					break;
				}
			} i-d < 1 i-d i d 1 {
				if (i+d >= n) {
					number++;
					break;
				}
			} if (i+d >= n) {
					number++;
					break;
				} i+d >= n i+d i d n {
					number++;
					break;
				} number++ number break; if (i-d == 1) {
				tree = i+d;
				number++;
			} else {
				if (i+d == n) {
					number++;
					break;
				}
				if (i-d == tree+1) {
					tree = i+d;
					number++;
				}
				if (tree >= n) {
					break;
				}
			} i-d == 1 i-d i d 1 {
				tree = i+d;
				number++;
			} tree = i+d tree i+d i d number++ number {
				if (i+d == n) {
					number++;
					break;
				}
				if (i-d == tree+1) {
					tree = i+d;
					number++;
				}
				if (tree >= n) {
					break;
				}
			} if (i+d == n) {
					number++;
					break;
				} i+d == n i+d i d n {
					number++;
					break;
				} number++ number break; if (i-d == tree+1) {
					tree = i+d;
					number++;
				} i-d == tree+1 i-d i d tree+1 tree 1 {
					tree = i+d;
					number++;
				} tree = i+d tree i+d i d number++ number if (tree >= n) {
					break;
				} tree >= n tree n {
					break;
				} break; System.out.println(number) System.out.println System.out System System.out number sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d = sc.nextInt();

		int tree = 0;
		int number = 0;
		for (int i=1; i<=n; i++) {
			if (i-d < 1) {
				if (i+d >= n) {
					number++;
					break;
				}
			} else if (i-d == 1) {
				tree = i+d;
				number++;
			} else {
				if (i+d == n) {
					number++;
					break;
				}
				if (i-d == tree+1) {
					tree = i+d;
					number++;
				}
				if (tree >= n) {
					break;
				}
			}
		}

		System.out.println(number);
		sc.close();
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d = sc.nextInt();

		int tree = 0;
		int number = 0;
		for (int i=1; i<=n; i++) {
			if (i-d < 1) {
				if (i+d >= n) {
					number++;
					break;
				}
			} else if (i-d == 1) {
				tree = i+d;
				number++;
			} else {
				if (i+d == n) {
					number++;
					break;
				}
				if (i-d == tree+1) {
					tree = i+d;
					number++;
				}
				if (tree >= n) {
					break;
				}
			}
		}

		System.out.println(number);
		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d = sc.nextInt();

		int tree = 0;
		int number = 0;
		for (int i=1; i<=n; i++) {
			if (i-d < 1) {
				if (i+d >= n) {
					number++;
					break;
				}
			} else if (i-d == 1) {
				tree = i+d;
				number++;
			} else {
				if (i+d == n) {
					number++;
					break;
				}
				if (i-d == tree+1) {
					tree = i+d;
					number++;
				}
				if (tree >= n) {
					break;
				}
			}
		}

		System.out.println(number);
		sc.close();
	}
}
