James has 30 dollars to spend on pens and pencils for the beginning of middle school. He spends 12 dollars on pens and packs of pencils are 2 dollars each.

What is the greatest number of pencils James can buy?