Tokyo is the global city facing most risks to its annual economic output, due to its proximity to North Korea, according to an index compiled by the Lloyd’s of London insurance market.

New York ranks second in the risk index at nearly $15 billion in annual GDP at risk, with a possible stock market crash its biggest threat.

Potential threats include everything from rare events, such as earthquakes, to more frequent concerns, such as cyber attacks.

The 279 cities in the Lloyd’s City Risk Index have a combined gross domestic product of $35 trillion and risk losing $547 billion in economic output annually as a result of 22 threats ranging from interstate conflicts to tropical storms, the index showed on Wednesday.

More than $24 billion annually in gross domestic product is at risk in Tokyo, with interstate conflict the city’s biggest threat.

Tokyo’s ranking “reflects the much greater risks around North Korea,” said Bruce Carnegie-Brown, chairman of Lloyd’s.

“Tokyo also has relatively poor resilience to interstate conflict because of its underinvestment in defense capabilities.”

A stock market crash is the costliest threat to gross domestic product for New York and some other U.S. cities, including Chicago and San Francisco, as well as Toronto, Montreal and Vancouver in Canada.

However, flooding poses the costliest threat, collectively, across cities in the U.S. and Canada.

North American cities feature highly in the global ranking, in part, because a strong economy in the region means there is more to lose, Lloyd’s said.

An earthquake is the costliest threat for Los Angeles, Lloyd’s said.

Third-placed Manila has over $13 billion at risk, with tropical windstorm top of its risks.

London has more than $8 billion at risk, placing it ninth in the index, with a market crash also its biggest threat.

“Investing in resilience – from physical flood defenses to digital firewalls and enhanced cyber security, combined with insurance – will help significantly reduce the impact of extreme events on cities, improve economic stability and enhance prosperity for all,” Carnegie-Brown said.

(Reporting by Carolyn Cohn in London and Suzanne Barlyn in New York)