This page is still under construction.

Parts of this page are still being built. What you see may change.

Best guess in the random game

Interview

Time limit1sMemory limit256 MB

Summary
Pick the number from 1 to N whose interval of radius K covers the most hidden values and report its coverage count.
Level

Easy2 of 10

Topics
Math, Intervals
Solved
No attempts yet

Problem

The grader picks one integer uniformly at random between 1 and NN. Call that integer RR. Without seeing RR, you print one integer XX between 1 and NN, and you win when ∣X−R∣≤K|X - R| \le K.

Find the XX that wins with the highest probability. When several values of XX tie, take the smallest one. Also count how many values of RR let that XX win.

Input

The first line contains two integers NN and KK separated by one space. (1≤N≤1091 \le N \le 10^9, 0≤K≤1090 \le K \le 10^9)

Output

On the first line, print the smallest XX among those with the highest winning probability, then the number of values of RR that satisfy ∣X−R∣≤K|X - R| \le K for that XX, separated by one space.

Examples3

  1. Example 1

    Input
    10000 100
    
    Expected output
    101 201
    
  2. Example 2

    Input
    1 0
    
    Expected output
    1 1
    
  3. Example 3

    Input
    5 10
    
    Expected output
    1 5