Machine-to-Machine (M2M) communications emerge to achieve ubiquitous communications among all the networked devices. One challenging problem in M2M applications is to discover the resources provided by the devices efficiently. This challenge arises from two perspectives: (1) a large number of heterogeneous devices co-exist and most of them are constrained devices (e.g., limited processing capability), (2) different communication protocols are utilized to get access to different types of resources provided by the devices (e.g., humidity information provided by a sensor). This paper proposes distributed resource directory architecture for M2M applications, referred to as DRD4M. The DRD4M supports heterogeneous devices using HTTP and CoAP protocols for resource registration and lookup. This enables the interoperability among heterogeneous devices and resource access to constrained devices from disparate network including the Internet. The DRD4M introduces two components: a resource registration component for registering resources and a resource lookup component with caching functionality for handling resource lookup with filtering. A peer-to-peer (P2P) overlay is introduced in DRD4M to connect resource peers to avoid single point of failure. A real-world prototype is implemented and is verified with a demo application. Preliminary performance evaluation in terms of response time of resource lookup is provided.