A court complaint says two men who brought explosives to a protest outside New York City’s mayoral mansion said they were inspired by the Islamic State extremist group.