PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#BS0000159. Tăng phần tử để đạt tần suất lớn nhất (To Add or Not to Add)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Tăng phần tử để đạt tần suất lớn nhất (To Add or Not to Add)

To Add or Not to Add

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

You are given nn integers and may perform at most kk operations. Each operation increments one chosen element by exactly 11; the same element may be chosen repeatedly. Maximize the frequency of any value after the operations. If several values achieve the maximum frequency, output the smallest such value.

Input

  • The first line contains n,kn,k.
  • The second line contains nn integers a1,…,ana_1,\ldots,a_n.

Output

Print the maximum achievable frequency followed by the smallest value that achieves it.

Subtasks

  • Subtask 1 (20 points): 1≤n≤501\le n\le 50; 0≤k≤1090\le k\le 10^9; −109≤ai≤109-10^9\le a_i\le 10^9 for every ii.
  • Subtask 2 (30 points): 1≤n≤40001\le n\le 4000; 0≤k≤1090\le k\le 10^9; −109≤ai≤109-10^9\le a_i\le 10^9 for every ii.
  • Subtask 3 (50 points): 1≤n≤1051\le n\le 10^5; 0≤k≤1090\le k\le 10^9; −109≤ai≤109-10^9\le a_i\le 10^9 for every ii.

Examples

Input

5 3
6 3 4 0 2

Output

3 4

Explanation

Starting from [6,3,4,0,2][6,3,4,0,2] with k=3k=3, increment 33 once and 22 twice to obtain [6,4,4,0,4][6,4,4,0,4]. Thus 44 occurs three times. Four equal values cannot be obtained within three operations, so print 3 4.