B&M has struck a deal to take on dozens of Wilko’s 400 shops after it collapsed into administration.