High-Q cavity-induced synchronization in oscillator arrays