Depends on if the probability of a derailment is K per train mile, or K per car mile. And I suspect that the answer is "some of both". When a car has a mechanical failure that causes a derailment, that kind of derailment is going to be proportional to the number of car miles. Some other causes (misaligned switches, say) will be proportional to the number of train miles.