#include #include #include using namespace std; int n,m; int d[20000]; int main() { scanf("%d %d",&n,&m); memset(d,-1,sizeof(d)); queue q; d[n]=0; q.push(n); while (!q.empty()) { int x=q.front(), y; q.pop(); y=x-1; if (0