BUCHAREST, ROMANIA, AUG. 20 -- Israeli Prime Minister Yitzhak Shamir said after winding up nine hours of talks with President Nicolae Ceausescu today that they failed to narrow differences on how to achieve peace in the Middle East.

Shamir told a news conference in Bucharest that Romania and Israel had agreed, however, to continue to work to find ways of narrowing the gap in their views.

"We left off in a feeling of friendship and optimism that indeed we in one way or another are coming closer to peace," he told reporters later after returning to Israel.

Shamir gave no details of what form continued cooperation might take and what, if any, concrete proposals were made by each side in what he termed "very substantial and profound" two-day discussions.

{In Moscow, Foreign Ministry spokesman Gennadi Gerasimov said that Soviet and Israeli officials have held talks in Bonn on the Middle East conflict, Reuter reported. Gerasimov said the Soviet side had reaffirmed its position that a resumption of diplomatic ties with Israel, broken off after the 1967 Middle East war, would be possible only in the context of work toward a settlement.}

Shamir confirmed that Israel and Hungary had agreed on establishing special interest sections in each other's countries. The agreement was first disclosed by Israeli Foreign Minister Shimon Peres on Tuesday.

Hungary will become the second East Bloc country to establish an interest section, operating through another country's embassy, in Israel. Israel and Poland established such offices in Tel Aviv and Warsaw earlier this year. All Soviet Bloc countries except Romania cut diplomatic ties with Israel after the Six Day War in 1967.

Ceausescu has used his contacts on both sides of the Mideast conflict to act as a broker and channel of communication in the past, most effectively in helping promote the Camp David agreement in 1978.

Shamir opposes an international conference on the Mideast, arguing that Israel would be pressured to make concessions to Arab demands.