The elliptic azimuthal anisotropy coefficient (v2) is measured for charm (D0) and strange (K0S, Λ, Ξ−, and Ω−) hadrons, using a data sample of p+Pb collisions collected by the CMS experiment, at a nucleon-nucleon center-of-mass energy of √sNN=8.16 TeV. A significant positive v2 signal from long-range azimuthal correlations is observed for all particle species in high-multiplicity p+Pb collisions. The measurement represents the first observation of possible long-range collectivity for open heavy flavor hadrons in small systems. The results suggest that charm quarks have a smaller v2 than the lighter quarks, probably reflecting a weaker collective behavior. This effect is not seen in the larger PbPb collision system at √sNN=5.02 TeV, also presented.