title: Win the frog race
body: <p>I came across this question and cannot come up with a solution. There is a frog race, the frog has a certain number of valid jumpsteps. It can move forward or backward. To win the race, the frog has to move as close to the finishing line as possible, but not overcross it. </p>
  
  <p>Example.
  <code>6, 1 7</code></p>
  
  <p>So, the finishing line is <code>6</code> units away and the frog can make jumps of <code>1</code> and <code>7</code> units both backwards and forward. Here, the output should be <code>6</code>, since the optimal strategy would be to go <code>1</code> unit backward and then <code>7</code> steps forward to get to the finishing line. </p>