Example 4 A group of tourists is traveling by car, with the requirement that the number of passengers in each car is equal. At first, each car carries 22 people, leaving 1 person unable to board. If one car leaves empty, then all the tourists can be evenly distributed among the remaining cars. It is known that each car can accommodate a maximum of 32 people. How many cars were there initially? How many tourists are there?
Let's assume there are $k$ cars at the beginning, and after one car leaves empty, the average number of passengers per car is $n$ people.
Obviously, $22<n \leqslant 32$.
From the problem, we have
$22 k+1=n(k-1)$
$\Rightarrow n=\frac{22 k+1}{k-1}=22+\frac{23}{k-1}$.
Since $n$ is a natural number, we have
$k-1=1$ or 23
$\Rightarrow k=2$ or 24.
When $k=2$, $n=45$ (which does not meet the condition, so we discard it);

When $k=24$, $n=23$.
At this point, $n(k-1)=23 \times 23=529$.