Resilient Average Consensus with Adversaries via Distributed Detection and Recovery