sample input |
sample output |

5 4 1 1 1 1 1 4 7 9 |
2 |

sample input |
sample output |

5 4 1 1 1 1 1 4 7 10 |
3 |

sample input |
sample output |

7 4 1 2 1 2 3 3 2 10 7 15 |
3 3 8 |

sample input |
sample output |

2 1 1 100 |
2147483647 |