William has $27,000 invested in stock A and stock B. Stock A currently sells for $30 a share and stock B sells for $90 a share. If stock B doubles in value and stock A goes up 50%, his stock will be worth $49,500. How many shares of each stock does he own?