#P12063. Overflowing Stone Containers
Overflowing Stone Containers
Overflowing Stone Containers
Two players, K and S, are playing a game resembling Go. In this game, each move involves capturing stones. The players have an unlimited supply of stones but each has exactly one container that can hold at most \(M\) stones.
The game record consists of \(n\) moves. In the \(i\)-th move, the current player captures \(a_i\) stones and adds them to their container. Player K (playing Black) makes the first move, and then players alternate. If, after any move, the total number of stones in a player's container becomes strictly greater than \(M\), that player loses the game. Note that even after a container overflows, the game record may continue, but the outcome is determined by the first overflow.
If no container ever overflows throughout the game, then the game is declared a draw.
Your task is to determine the winner based on the recorded moves. Output "K" if player K wins, "S" if player S wins, or "Draw" if neither container overflows.
inputFormat
The first line contains two integers \(n\) and \(M\): the number of moves and the maximum capacity of each container.
The second line contains \(n\) space-separated integers \(a_1, a_2, \ldots, a_n\), where \(a_i\) represents the number of stones captured during the \(i\)-th move.
outputFormat
Output a single line containing "K" if player K wins, "S" if player S wins, or "Draw" if no container overflow occurs.
sample
5 10
3 5 4 2 1
Draw