Here's the postal code prefixes by historic county:
K (Eastern Ontario): Addington, Carleton, Dundas, Frontenac, Glengarry, Grenville, Haliburton, Hastings, Lanark, Leeds, Lennox, Northumberland, Peterborough, Prescott, Prince Edward, Renfrew, Russell, Stormont, Victoria
L (Central Ontario): Dufferin, Durham, Halton, Lincoln, Ontario, Peel, Simcoe, Welland, Wentworth, York
M (Metropolitan Toronto)
N (Southwestern Ontario): Brant, Bruce, Elgin, Essex, Grey, Haldimand, Huron, Kent, Lambton, Middlesex, Norfolk, Oxford, Perth, Waterloo, Wellington
P (Northern Ontario districts): Algoma, Cochrane, Kenora, Manitoulin, Muskoka, Nipissing, Parry Sound, Rainy River, Sudbury, Thunder Bay, Timiskaming