//pku3618 Exploration #include <cstdio> #include <algorithm> #include <cmath> using namespace std; typedef long INT32; struct AbsGreater { bool operator() (const INT32& left, const INT32& right) const { return abs(left) < abs(right); } }; const INT32 MAX_N = 50000; INT32 dist[MAX_N]; INT32 nDist = 0; int main() { INT32 iT, iN; INT32 n; scanf("%ld %ld", &iT, &iN); for (n=0; n<iN; n++) { INT32 x; scanf("%ld", &x); if (x <= iT) dist[nDist++] = x; } sort(dist, dist+nDist, AbsGreater()); INT32 t = 0; INT32 xCur = 0; INT32 nVisit = 0; for (n=0; n<nDist; n++) { t += abs(dist[n] - xCur); if (t <= iT) { nVisit++; xCur = dist[n]; } else break; } printf("%ld/n", nVisit); return 0; }