The Toi invasion  was the invasion of northern Kyūshū by Jurchen pirates in 1019. At the time, Toi  meant "barbarian" in the Korean language. The Toi pirates sailed with about 50 ships from direction of Goryeo, then assaulted Tsushima and Iki, starting 27 March 1019. After the Iki Island garrison comprising 147 soldiers was wiped out, the pirates has proceed to Hakata Bay. For a week, using Noko Island  in the Hakata Bay as a base, they sacked villages and kidnapped over 1,000 Japanese, mostly women and young girls, for use as slaves. The Dazaifu, the administrative center of Kyūshū, then raised an army and successfully drove the pirates away. During the second failed raid to Matsuura 13 April 1019, three enemies were captured by the Japanese army. They were identified as Koreans. They said that they had guarded the borderland but had been captured by the Toi. However, this was unlikely, and the Japanese officers suspected them because there had been Korean pirates attacking Japan coasts during the Silla period. A few months later, the Goryeo delegate Jeong Jaryang  reported that Goryeo forces attacked the pirates off Wŏnsan and rescued about 260 Japanese. The Korean government then repatriated them to Japan where they were thanked by the Dazaifu and given rewards. There remain detailed reports by two captive women, Kura no Iwame and Tajihi no Akomi. These Jurchen pirates lived in what is today Hamgyŏngdo, North Korea.
Question: Which occurred first the second failed raid to Matsuura or the invasion of northern Kyūshū by Jurchen pirates?
Answer: invasion of northern Kyūshū