The US president expressed his frustration at the conduct of the two nations.