Distributed Anomaly Detection for M2M Applications