f n s (a:as) =
  if s' < 0 then Nothing else f n s' as
  where
    s' = s + a - n
f n s (a:as) =
  if s' < 0 then Nothing else f n s' as
  where
    s' = s + a - n
f n s (a:as) =
  if s' < 0 then Nothing else f n s' as
  where
    s' = s + a - n