Hello from MrBillDoesMath! 
 
Answer: 
9, 11
 
Discussion: 
From the attachment,
P = w + l + w + l 
 = 2w + 2l => as l = w + 2
 = 2w + 2( w+2) 
 = 4w + 4
 = 40 (given value)
4w + 4= 40 => subtract 4 from both sides
4w = 40 -4 = 36 => divide both sides by 4
w = 36/4 = 9
This implies that l = w+2 = 9 + 2 = 11
 
Thank you, 
 
MrB