We got our MDF board cut at Home Depot (for free) to the dimensions of the shelving unit. The board cost us less than $15 and we had enough for both window benches with some board left over.
Here is some advice for the piece of foam. DO NOT buy your foam through a craft store like Hobby Lobby, Joann’s, Michael’s, etc. It costs way too much! I found a piece of foam at Smith’s Marketplace for $20 which was big enough for 2 window benches. They had smaller sizes too so if you are just making one window bench, you can easily find a piece of foam for probably $10 or less at a hardware store or a similar store.