Efficient construction of 2-chains with a prescribed boundary