Yes, this is possible.
On the usage restriction tab select the product (x) that must be in the cart.
On the product tab set ‘Minimum quantity of marching products’ to 1.
On the product tab check the box ‘Allow multiplication’.
On the product tab enter the ‘Free product’ to give away (y)
On the misc tab check ‘Auto coupon’