CF1901A.Line Trip

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Line Trip

There is a road, which can be represented as a number line. You are located in the point 00 of the number line, and you want to travel from the point 00 to the point xx, and back to the point 00.

You travel by car, which spends 11 liter of gasoline per 11 unit of distance travelled. When you start at the point 00, your car is fully fueled (its gas tank contains the maximum possible amount of fuel).

There are nn gas stations, located in points a1,a2,,ana_1, a_2, \dots, a_n. When you arrive at a gas station, you fully refuel your car. Note that you can refuel only at gas stations, and there are no gas stations in points 00 and xx.

You have to calculate the minimum possible volume of the gas tank in your car (in liters) that will allow you to travel from the point 00 to the point xx and back to the point 00.

Input

The first line contains one integer tt (1t10001 \le t \le 1000) — the number of test cases.

Each test case consists of two lines:

  • the first line contains two integers nn and xx (1n501 \le n \le 50; 2x1002 \le x \le 100);
  • the second line contains nn integers a1,a2,,ana_1, a_2, \dots, a_n ($0 \lt a_1 \lt a_2 \lt \dots \lt a_n \lt x$).

Output

For each test case, print one integer — the minimum possible volume of the gas tank in your car that will allow you to travel from the point 00 to the point xx and back.

Note

In the first test case of the example, if the car has a gas tank of 44 liters, you can travel to xx and back as follows:

  • travel to the point 11, then your car's gas tank contains 33 liters of fuel;
  • refuel at the point 11, then your car's gas tank contains 44 liters of fuel;
  • travel to the point 22, then your car's gas tank contains 33 liters of fuel;
  • refuel at the point 22, then your car's gas tank contains 44 liters of fuel;
  • travel to the point 55, then your car's gas tank contains 11 liter of fuel;
  • refuel at the point 55, then your car's gas tank contains 44 liters of fuel;
  • travel to the point 77, then your car's gas tank contains 22 liters of fuel;
  • travel to the point 55, then your car's gas tank contains 00 liters of fuel;
  • refuel at the point 55, then your car's gas tank contains 44 liters of fuel;
  • travel to the point 22, then your car's gas tank contains 11 liter of fuel;
  • refuel at the point 22, then your car's gas tank contains 44 liters of fuel;
  • travel to the point 11, then your car's gas tank contains 33 liters of fuel;
  • refuel at the point 11, then your car's gas tank contains 44 liters of fuel;
  • travel to the point 00, then your car's gas tank contains 33 liters of fuel.

Samples

3
3 7
1 2 5
3 6
1 2 5
1 10
7
4
3
7

在线编程 IDE

建议全屏模式获得最佳体验