t = 1 #t = int(input()) from heapq import heappush, heappop for _ in range(t): n,s = map(int, input().split()) a = list(map(int, input().split())) a.sort(reverse = True) s -= 1 cur = 0 hq = [] if a[0] > s: print(a[0]) continue ma = 0 for i in range(n): if s >= a[i]: s -= a[i] heappush(hq,0) if a[i] <= ma: continue cur = heappop(hq) ma = max(ma,cur+1) heappush(hq,cur+1) print(ma)