The present invention provides substituted diamino-pyrimidine and substituted diamino-pyridine derivatives of Formula I wherein X, Y, R1, R2, and Ar are defined herein, that modulate the activity of phosphoinositide 3-kinases (PI3Ks) and are useful in the treatment of diseases related to the activity of PI3Ks including, for example, inflammatory disorders, immune-based disorders, cancer, and other diseases.