All submissions for this problem are available.In a Circular City, there are $n$ houses, numbered from 1 to n and arranged in 1,2,...,n,1,2,... Chef needs to deliver packages to $m$ (m<=n) houses. Chef is initially at house 1. Chef decides an integer $x$ and stops after every $x$ houses. i.e- if $n=7$ and $x=2$. He will stop at 1,3,5,7,2,... He may deliver a package when he stops at a house. His work is done when all the packages are delivered. What is the minimum number of times Chef has to stop, if he can choose any $x$ ? __Note__: Starting point (1) is also counted in number of stops ###Input: - First line will contain $n, m$, denoting number of houses and number of packages respectively. - Next line contains $m$ distinct space separated integers denoting the houses ###Output: Single line containing an integer denoting minimum number of stops. ###Constraints - $3 \leq n \leq 1000$ - $1 \leq m \leq n$ ###Sample Input 1: 5 3 1 2 4 ###Sample Output 1: 3 ###Sample Input 2: 6 2 3 4 ###Sample Output 2: 4 ###EXPLANATION: For first input, If Chef chooses $x=3$, he will stop at 1, 4, 2 before delivering all the packages. For second, If Chef chooses $x=1$, he will stop at 1, 2, 3, 4 before delivering all the packages.
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS|
Fetching successful submissions