Element X, with electronic configuration 2, 8, 2 and element Y with electronic configuration 2,…