Only a few? Let’s see (from West to East):

North Sea
Emden
Wilhelmshaven
Bremen
Bremerhaven
Cuxhaven
Hamburg
Husum
(the rest are town, not cities)
Baltic Sea
Flensburg
Eckernförde
Kiel
Lübeck
Wismar
Rostock
Stralsund
Greifswald
Please do not say “these are not cities” – they are and many of them used to be Hanseatic cities with great economic, political and military power, historically highly significant. And do not say “they are not on the sea”. They all have seaports and this is the defining element.

The German sea coasts are rather rugged, with lots of islands in front of the coast. So, the cities are located in bays and rivermouths which form natural harbours.