Generative Probabilistic Model for Detecting Selection on Dispersed Genomic Elements from Polymorphism and Divergence