def get_num_gophers(blades, remainders, M):
    """Find no. of gophers given no. of blades and remainders."""
    for i in range(1, M + 1):
        congruences = all([i % b == r for b, r in zip(blades, remainders)])
        if congruences:
            return i
    return None