M1's trading algorithm compares your current holdings to your target portfolio allocations to determine which securities are overweight and underweight. Money is first divested from overweight securities, and money is first invested in underweight securities.