# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np

# なんこか入力
n,x = map(int, input().split())

# 空白区切りの数列をリストに代入
a = [int(i) for i in input().split()]

a=sorted(a)

#print(a)
answer=0
for i in range(n-1):
    if x >= a[i]:
        answer += 1
        x -= a[i]
        print(x,a[i])
    else:
        break
if x == a[n-1]:
    answer += 1
print(answer)

