NEW YORK - Wal-Mart Stores Inc. is in a race against time to give shoppers what they want before they get comfortable going elsewhere.

Customers who switched to other stores when Wal-Mart decided to ditch best-selling toothbrush brands, craft supplies, and bolts of fabric may be hard to win back.

The company has taken nine months to restore thousands of grocery items, including some best-selling brands, it dumped two years ago. The idea then was to tidy up stores for the wealthier customers it had won during the recession.

Grocery sales have improved, rising in the low single digits in the first quarter. But overall traffic at its U.S. namesake stores has been down, and revenue at stores open at least a year has posted eight straight quarters of declines on a year-over-year basis.

President and chief executive officer Mike Duke on Friday outlined a five-point program at Wal-Mart's annual shareholders meeting to help the Bentonville, Ark., company sell more on the Internet at home and abroad while keeping its costs and prices low.

"Our next-generation customer will include millions who are striving to join the emerging global middle class," Duke said. "They're connected to the world through smartphones and social media. They're in charge of when they shop and how they shop, and they know who has the lowest prices."

He said expanding globally and marketing to the "next-generation customer" were Wal-Mart's long-term goals.

It will take until the end of 2011 to restock the rest of each of its stores with items that were culled, from craft supplies to home furnishings. That will go a long way toward restoring Wal-Mart's ability to provide one-stop shopping, which could be a plus as shoppers make fewer trips to save on gasoline.

"The customer, for the most part, is still in the store shopping, but they started doing some more shopping elsewhere, and we want to bring them back. We know that it's easy to lose them," said Wal-Mart's chief financial officer, Charles Holley, during a conference last week.

Meanwhile, dollar stores, which benefited from shoppers trying to stretch their money in the recession, are continuing to gain new customers and post higher revenue. The trend has accelerated as gasoline prices closed in on $4 a gallon.

Dollar stores have more adroitly maneuvered in the post-recession economy. They have expanded their inventory, particularly brand names, become more competitive on price, and are expanding to new locations. At the same time, some wealthier shoppers are trading back up to the mall or higher-end grocery stores such as Whole Foods.

Together, those patterns mean Wal-Mart is increasingly "caught in the middle" between dollar stores and more expensive stores, Wall Street Strategies analyst Brian Sozzi said. "Now, it's trying to return to its roots, but it's facing old competitors - the dollar stores - that are getting much better."

The restocking has taken longer than Wal-Mart predicted. In November, it had said that the merchandise it cut would be restored by this spring.

Even when Wal-Mart has been able to get goods to the stores, the company known for its efficiency has had trouble getting the products onto shelves, said Cameron Smith, who recruits executives for Wal-Mart suppliers and also serves as an adviser.

For example, pallets of merchandise are crowding aisles, Sozzi said.