Two-memory reinforcement learning