QOJ.ac

QOJ

시간 제한: 2 s 메모리 제한: 256 MB 총점: 100 해킹 가능 ✓

#16899. Connected Car Experiment

통계

Thanks to the development of information and communication technology (ICT), the connected car, which provides various services to drivers through internet connectivity—once considered a futuristic vehicle—has become a reality. In line with this, Hyundai AutoEver is building a next-generation connected car service platform that applies the latest ICT, including cloud and the Internet of Things (IoT), and is accumulating core software technologies to perfect the ultimate connected car.

Hyuno, an engineer at Hyundai AutoEver, decided to conduct an experiment combining IoT and location-based technology, which are core technologies for connected cars, while brainstorming new services. The experimental program developed by Hyuno has the following features:

  • Hyuno can remotely control connected cars that are connected to the IoT.
  • When a connected car that is connected to the IoT is at the same location as a connected car that is not, the latter can be connected to the IoT. Once connected, the connection is maintained even if the two cars move away from each other later.

For the experiment, Hyuno placed $N$ connected cars, numbered from $1$ to $N$, in a line. The initial position of the $i$-th connected car is $x_i$, and its fuel capacity is $h_i$. Every connected car consumes $1$ unit of fuel to travel a distance of $1$, and it can no longer move once its fuel is exhausted.

Initially, none of the connected cars are connected to the IoT. Hyuno first connects the $S$-th connected car to the IoT and intends to propagate the IoT connection to other connected cars by appropriately using the program's features.

Depending on how Hyuno maneuvers the connected cars, the set of connected cars that end up connected to the IoT can vary. Find all connected cars that have the potential to be connected to the IoT when Hyuno conducts the experiment in various ways.

Input

The first line contains $N$ and $S$. ($1 \le N \le 1\,000\,000$; $1 \le S \le N$)

The second line contains the initial positions $x_1, x_2, \dots, x_N$ of each connected car, separated by spaces. ($0 \le x_i \le 10^9$; $x_i \le x_{i+1}$)

The third line contains the fuel capacities $h_1, h_2, \dots, h_N$ of each connected car, separated by spaces. ($1 \le h_i \le 10^9$)

Output

Output the numbers of all connected cars that have the potential to be connected to the IoT, sorted in ascending order.

Examples

Input 1

5 3
1 2 4 5 8
2 1 2 2 3

Output 1

1 2 3 4

Note

In the example, the possible sets of connected cars that can be connected to the IoT as a result of the experiment are $\{1, 2, 3\}$, $\{2, 3\}$, $\{3\}$, and $\{3, 4\}$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.