And they reasoned among themselves, saying, It is because we have taken no bread. But Jesus, aware of this, said unto them, O ye of little faith, why reason ye among yourselves, because ye have brought no bread? Do ye not yet understand, neither remember the five loaves of the five thousand, and how many baskets (kophinoi) ye took up? Neither the seven loaves of the four thousand, and how many baskets (spyridas) ye took up? How is it that ye do not understand that I spake it not to you concerning bread, that ye should beware of the leaven of the Pharisees and of the Sadducees? Then understood ...they how that He bade them not beware of the leaven of bread, but of the doctrine of the Pharisees and of the Sadducees. They thought that He was telling them to guard themselves against the stain of Jewish food, which is why they discussed among themselves that they had not brought any bread. He upbraids them for being mindless and of little faith. They were mindless by not remembering how many He had fed with how many loaves; they showed little faith by not believing that Christ Himself could provide bread even if they had not bought any bread from the Jews. As He rebuked them rather sharply - for meekness is not good on every occasion - they immediately understood that by "leaven" He meant "teaching"; such is the effect of a judicious rebuke on any occasion.
Source: Commentary on Matthew