#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using std::cout; using std::cin; using std::string; using std::vector; int main() { int n, m; cin >> n >> m; vector arr(n); long long average = 0; for (int i = 0; i < n; i++) { cin >> arr[i]; average += arr[i]; } average /= n; cout << std::min(average, (long long)arr[0]) / m; }