General Tilly and the Duke of Wallenstein play "Divide and rule!" (Divide et impera!).
To this end, they arrange $N$ tin soldiers in $M$ companies and command them by turns.
Both of them must give a command and execute it in their turn.

Only two commands are possible: The command "[i]Divide![/i]" chooses one company and divides it into two companies, where the commander is free to choose their size, the only condition being that both companies must contain at least one tin soldier.
On the other hand, the command "[i]Rule![/i]" removes exactly one tin soldier from each company.

The game is lost if in your turn you can't give a command without losing a company. Wallenstein starts to command.

a) Can he force Tilly to lose if they start with $7$ companies of $7$ tin soldiers each?

b) Who loses if they start with $M \ge 1$ companies consisting of $n_1 \ge 1, n_2 \ge 1, \dotsc, n_M \ge 1$ $(n_1+n_2+\dotsc+n_M=N)$ tin soldiers?
To solve this problem, we need to analyze the game mechanics and determine the optimal strategy for both players. Let's break down the problem into parts a) and b).

### Part a)
We start with 7 companies, each containing 7 tin soldiers.

1. **Initial Setup:**
   - Number of companies, \( M = 7 \)
   - Number of soldiers in each company, \( n_i = 7 \) for \( i = 1, 2, \ldots, 7 \)

2. **Game Mechanics:**
   - The command "Divide!" splits one company into two, with each new company having at least one soldier.
   - The command "Rule!" removes one soldier from each company.

3. **Strategy Analysis:**
   - If Wallenstein (the Duke) starts, he can always mirror Tilly's moves.
   - If Tilly divides a company, Wallenstein can also divide a company in such a way that one of the new companies has only 1 soldier.
   - If Tilly uses the "Rule!" command, Wallenstein can also use the "Rule!" command.

4. **Endgame Analysis:**
   - The game ends when a player cannot make a valid move without losing a company.
   - If both players keep dividing companies, eventually, all companies will have 1 soldier each.
   - The total number of moves to reach this state is calculated as follows:
     - Each company needs to be divided 6 times to reach 1 soldier (since \( 7 - 1 = 6 \)).
     - Total moves = \( 6 \times 7 = 42 \).

5. **Turn Calculation:**
   - Wallenstein starts, so he makes the 1st, 3rd, 5th, ..., 41st move.
   - Tilly makes the 2nd, 4th, 6th, ..., 42nd move.

Since the last move (42nd) is made by Tilly, he will be the one who cannot make a valid move next, leading to his loss.

### Conclusion for Part a:
Wallenstein can force Tilly to lose if they start with 7 companies of 7 tin soldiers each.

The final answer is Wallenstein wins if \( \boxed{ N - M } \) is even, and Tilly wins if \( N - M \) is odd.