Neither account says anything about this being his "first sermon." Probably two different sermons with similar content.
Matthew doesn't say the sermon on the mount was His first sermon. Matthew doesn't seem too concerned about the sequence of events. Matthew 4:23 seems to indicate that before this the Lord already had done a lot of speaking.
In Luke 6:17 was to the crowds, whereas the one in Matthew 5 was addressed to the disciples privately. It is not at all uncommon for a preacher to preach similar sermons at different times and with different audiences, now is it?