It's not clear from your post how you have set up your products. Have you created a separate product for each size? If so, you could simply set the "Products Qty Maximum" when adding or editing a product.

If you have set the sizes using attributes, then you would need to resort to custom programming as the products quantity fields only operate at product level.