#K5671. Chest Game: Determine the Winner
Chest Game: Determine the Winner
Chest Game: Determine the Winner
Two players are playing a coin collection game involving M chests. Each chest contains some coins. In each move, a player may collect coins from one or more chests with the following restrictions:
- The maximum number of coins that can be taken in a single move is given by K.
- If the total number of coins in all chests is less than or equal to K, the first player wins immediately.
- If any individual chest contains more than K coins, then the move is illegal for the first player and the second player wins.
- Otherwise, the game proceeds in turns. The winner is determined by the parity of the number of full moves possible. In other words, if \(\left\lfloor \frac{\text{total coins}}{K} \right\rfloor\) is odd, the first player wins; if it is even, the second player wins.
Your task is to implement a program that, given the parameters of the game, determines the winner as either "First" or "Second".
inputFormat
The input is read from standard input (stdin) and is formatted as follows:
M K c1 c2 ... cM
Where:
- M is the number of chests.
- K is the maximum number of coins that can be collected in one move.
- ci represents the number of coins in the i-th chest.
outputFormat
Output a single line to standard output (stdout) containing either "First" if the first player wins or "Second" if the second player wins.
## sample3 5
1 2 3
First
</p>