John Doe has recently found a "Free Market" in his city — that is the place where you can exchange some of your possessions for other things for free. 

John knows that his city has n items in total (each item is unique). You can bring any number of items to the market and exchange them for any other one. Note that each item is one of a kind and that means that you cannot exchange set {a, b} for set {v, a}. However, you can always exchange set x for any set y, unless there is item p, such that p occurs in x and p occurs in y.

For each item, John knows its value ci. John's sense of justice doesn't let him exchange a set of items x for a set of items y, if s(x) + d < s(y) (s(x) is the total price of items in the set x). 

During one day John can exchange only one set of items for something else. Initially, he has no items. John wants to get a set of items with the maximum total price. Find the cost of such set and the minimum number of days John can get it in. 

Input

The first line contains two space-separated integers n, d (1 ≤ n ≤ 50, 1 ≤ d ≤ 104) — the number of items on the market and John's sense of justice value, correspondingly. The second line contains n space-separated integers ci (1 ≤ ci ≤ 104).

Output

Print two space-separated integers: the maximum possible price in the set of items John can get and the minimum number of days needed to get such set.

Examples

Input

3 2
1 3 10


Output

4 3


Input

3 5
1 2 3


Output

6 2


Input

10 10000
10000 9999 1 10000 10000 10000 1 2 3 4


Output

50010 6

Note

In the first sample John can act like this: 

  * Take the first item (1 - 0 ≤ 2). 
  * Exchange the first item for the second one (3 - 1 ≤ 2). 
  * Take the first item (1 - 0 ≤ 2). 
import java.io.*;
import java.util.*;

public class Main
{
	public static void main(String[] args) throws IOException
	{
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int d = in.nextInt();
		int[] c = new int[n];
		for(int i = 0; i < n; ++i)
			c[i] = in.nextInt();
		
		boolean[] feasible = new boolean[500001];
		feasible[0] = true;
		int sum = 0;
		for(int ci: c)
		{
			for(int i = sum; i >=0; --i)
				feasible[i + ci] |= feasible[i];
			sum += ci;
		}
		
		ArrayList<Integer> values = new ArrayList<Integer>();
		for(int i = 0; i <= sum; ++i)
			if(feasible[i])
				values.add(i);
		values.add(Integer.MAX_VALUE);
		
		int step = 0, result = 0;
		int index = 0;
		while(true)
		{
			int originIndex = index;
			while(result + d >= values.get(index))
				++index;
			--index;
			if(originIndex == index)
				break;
			++step;
			result = values.get(index);
		}
		System.out.println(result + " " + step);
	}
}



/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////

class FunLib
{
	public static long gcd(long a, long b)
	{
		if(b == 0)
			return a;
		return gcd(b, a % b);
	}
	
	public static int gcd(int a, int b)
	{
		if(b == 0)
			return a;
		return gcd(b, a % b);
	}
	
	public static long lcm(long a, long b)
	{
		return a / gcd(a, b) * b;
	}
	
	public static int[][] transpose(int[][] mat)
	{
		int r = mat.length;
		int c = mat[0].length;
		int[][] result = new int[c][r];
		for(int i = 0; i < c; ++i)
			for(int j = 0; j < r; ++j)
				result[i][j] = mat[j][i];
		return result;
	}
}

abstract class AbstractSegTree
{
	public AbstractSegTree(int aSize)
	{
		size = aSize;
		storage = new int[4 * size];
	}
	
	public int getVal(int index)
	{
		return getValHelper(0, 0, size - 1, index);
	}
	
	public void rangeSet(int lower, int upper, int val)
	{
		rangeSetHelper(0, 0, size - 1, lower, upper, val);
	}
	
	protected abstract int getValHelper(int node, int beg, int end, int index);
	protected abstract void rangeSetHelper(int node, int beg, int end, int lower, int upper, int val);
	protected int[] storage;
	protected int size;
}


class Trie
{
	public Trie()
	{
		currentNode = root;
	}
	
	public void reset()
	{
		currentNode = root;
	}
	
	public void add(String word)
	{
		currentNode = root;
		for(int i = 0; i < word.length(); ++i)
		{
			// Only upper case characters
			int nodeIndex = word.charAt(i) - 'A';
			if(currentNode.children[nodeIndex] == null)
				currentNode.children[nodeIndex] = new Node();
			currentNode = currentNode.children[nodeIndex];
		}
		currentNode.isWord = true;
		currentNode = root;
	}
	
	public boolean feed(char c)
	{
		if(currentNode.children[c - 'A'] == null)
			return false;
		currentNode = currentNode.children[c - 'A'];
		return true;
	}
	
	public boolean isCurrentWord()
	{
		return currentNode.isWord;
	}
	
	private static class Node
	{
		public boolean isWord;
		// Only upper case characters
		public Node[] children = new Node[26];
	}
	
	private Node root = new Node();
	private Node currentNode;
}