In this paper we classify finite groups whose nonnormal subgroups are of order p or pq, where p, q are primes. As a by-product, we also classify the finite groups in which all nonnormal subgroups are cyclic.