On a table, 2009 cards are laid out in a row. Initially, all cards have their white side up and their black side down. The cards are numbered from 1 to 2009.
Two players $A$ and $B$ take turns making a move, with $A$ starting first. Each move consists of the player selecting a card with number $k (k < 1969)$, whose white side is up, and then flipping the cards with numbers $k, k+1, k+2, \ldots, k+40$ in their positions. The last player who can make a valid move wins the game.
a) Determine whether this game necessarily ends.
b) For which of the two players does a winning strategy exist?
a) If the game does not end, then due to the at most $2^{2008}$ different possible game states, there must exist a periodically repeating sequence of states. Let $k$ be the smallest number of the cards that are flipped within this period. To flip the card with the number $k$ from black to white, however, a card with a smaller number than $k$ must be chosen - contradiction to the minimality! Therefore, the game must end after a finite number of moves.
b) We consider the cards with the numbers $41k$, where $1 \leq k \leq 48$. The highest of these cards with the number 1968 is the last one that can be selected. With each move, exactly one of these cards is flipped. Since the game ends when all cards up to the number 1968 are black, and because these cards are all white at the beginning, after each double move by $A$ and $B$, an even number of them are white again; $B$ thus always finds an odd number of white cards from this set and can always make a move. Therefore, $B$ necessarily wins the game, regardless of how he plays.
Hints: The finiteness can also be shown by translating the game states into a monotonically changing binary number. If the card with the number 1969 were also allowed to be selected in the problem statement, then $A$ would have a winning strategy. For part a), 4 points were awarded, and for part b), 6 points were awarded.