I ran into the same problem with the same board. I went to Fry's Electronics since I didn't have an older cpu access the bios in order to flash the bios with. Cost 17USD and they put the 7700K in and works great.
The cheapest CPU that will work in the z170 boards is between 30-40USD. I ran into the same issue again with a friends asus board. We picked up a cheap cpu to flash his bios with. Word of caution check the forums for the most stable version of the bios to flash.
We had to reset then reflash to bios with the most stable version that would accept Kaby Lake cpus. I hope this helps.
Changing the BIOS chip is another option like stated above. Ebay is your best beat on finding a decent priced one. If you do decide to purchase a new BIOS chip, make sure its the newest one.
Good luck mate!