both food and exercise can be contributing...and you will adjust. food as they say above, exercise because some of the muscles near the intestines "massage" the intestines when you use them and stimulates things along---just ask a runner about running and pooping, guarantee every serious runner has stories. Once your system adjusts to the food, the exercise will help keep you regular.
If the gas is too uncomfortable, try some beano for awhile until you get more adjusted.
Lost successfully, maintained successfully. Followed by a whole lot of setbacks and obstacles. Starting over with the knowledge gained before.