Create Greedy Algorithm for Maximizing Value

Given a list of various funding agencies and potential sponsors, which agencies should you choose to sign with? 
You have a deadline of 'n' days.
Each application takes one day to complete.
Each agency offers a fixed amount of funding, and represented by a pair of integers (d,v) where d is deadline, and v is value of funding.
Given more funding agencies than the deadline, how should you schedule them to obtain the max possible funding?

Takes in a text file, of 2 columns. The first row values are 'n' and 'm' values in that order.
The following lines will be the 'd' and 'v' values, in that order.