Problem:
Score : 400 points

Problem Statement

You are given positive integers N and M.

How many sequences a of length N consisting of positive integers satisfy a_1 \times a_2 \times ... \times a_N = M? Find the count modulo 10^9+7.

Here, two sequences a' and a'' are considered different when there exists some i such that a_i' \neq a_i''.

Constraints

All values in input are integers.

1 \leq N \leq 10^5

1 \leq M \leq 10^9

Input

Input is given from Standard Input in the following format:

N M

Output

Print the number of the sequences consisting of positive integers that satisfy the condition, modulo 10^9 + 7.

Sample Input 1

2 6

Sample Output 1

4

Four sequences satisfy the condition: \{a_1, a_2\} = \{1, 6\}, \{2, 3\}, \{3, 2\} and \{6, 1\}.

Sample Input 2

3 12

Sample Output 2

18

Sample Input 3

100000 1000000000

Sample Output 3

957870001

Solution in Pascal (FPC 2.6.2) (judge verdict: Accepted)

var
	facs:array[0..2001]of int64=(1,437918130,722479105,419467694,390998217,688653593,752369730,314281677,848793393,302778600,641419708,359467170,109119920,291462451,581232364,367552188,19055157,519422664,377413248,184238535,100292593,867553799,680805768,637011622,838031598,954730329,14705621,854687367,82350513,562819783,341406877,11986940,406550952,924707067,697304278,812312671,493805103,750646179,797131515,125408444,593395757,743252791,97269816,625809105,95830437,318440909,191279856,448875092,764072301,941003529,541108809,339617910,981977466,917213110,693389065,939330647,454991628,655104206,938437020,681370120,969117405,153564086,124768900,190510895,380720579,742619942,919179148,860673190,784044468,356858318,849641758,257431766,926581590,488132488,633627778,593920661,234400402,266884017,181686381,657704891,532467852,928162624,121630724,523505981,242416192,940517951,451602922,692382743,856456398,303115999,299200938,638522519,484820571,4950879,652993557,595510479,747441725,565813117,719760882,162603635,531950728,765702160,363728672,790374244,776372982,160226878,217226757,800213188,425234994,877824191,682831525,230335073,830834436,706165316,540595539,144162001,433393698,893091420,997675228,844113510,577889084,874720012,937682696,117557725,705155009,72951350,379968087,950743483,342781022,184481043,153223816,558188636,516225514,438463836,350269020,332366222,493498994,753660595,128078583,238205526,927344283,470091512,192044710,849127063,854869794,502704967,961189336,188562846,643851306,204102562,576865589,574949854,772036106,417276573,773301250,463836195,473281893,894679367,4336597,363467250,317614965,728217456,554126869,874896552,76366192,677000234,337033639,284263197,264056892,538465762,645000912,157420482,14755475,572349905,770650027,208576717,412197753,283971481,892302331,872764474,810673643,764707385,62691675,425317917,827016778,685010988,575309116,86381823,285454093,583163727,483115382,953791654,224496577,413323992,74107909,779820672,988628897,796572345,968946248,444124793,368774859,887671982,535354688,145822049,516927020,988709092,910325210,790606609,425401251,824547428,11347322,841821068,372729338,910253320,383651345,626790213,636443576,633383307,105562610,725643552,766392363,418265499,957763794,832826328,343383160,237604935,582419882,608657845,330910979,511252139,701339131,463738716,849664749,739062237,357088405,324679509,109741460,455887877,269923768,424425198,965651681,471728725,543062503,485378429,571604742,321271335,504455561,509546975,763368909,150072577,232201666,695006444,375079861,765847341,405049322,304181169,685687553,228502082,23642405,733213722,77721395,994809954,217921085,750848255,415201993,877359318,816254961,208800253,165312868,912564763,267878880,620421028,687272398,965091903,910284938,959869931,579283662,460311839,233130006,832629547,806918317,789419725,976360299,66957513,792006720,964835096,764310323,943508794,320822040,855360826,994209082,998710584,451541316,540353405,782850762,83351016,164658610,399153119,484179393,900677914,548996970,540202385,502085905,305629510,414973328,733854511,999551600,929723194,856256948,190437395,831650911,189552007,540085415,264316037,647368479,724859258,63875222,549880942,884378502,48225947,200360748,217411774,428675555,204375967,163813057,11392828,63816753,122454906,279161231,177533667,31612358,140452161,19981188,287350626,225047490,810109242,455285322,682630228,317104780,38098465,981996609,566262664,244205492,11569855,360664468,210352560,808795375,66106220,996704108,52475795,835874618,706698117,834011569,82385442,767403009,260934484,581004588,146951720,315181594,18131026,67347184,660447354,317161158,310293330,957769185,795211642,251210316,376491240,482209772,337887965,715730781,169939932,942501868,896874971,156760010,409840176,442596118,448590113,340183632,448639753,139475086,446619980,683372898,330190835,658072182,120608013,345266529,873204774,859866616,327703544,840550890,500060231,737050414,343707056,929913795,364139378,713522909,605309034,892609044,95663389,422550956,440430257,676836771,616977443,372816409,516450892,308156304,727765485,154582382,122223283,703248501,916757163,626613065,673807982,165855749,104310832,619362396,666635368,551617377,725543210,320014428,83863469,696839568,820486897,690587073,476958860,785342455,964938385,434274056,793377933,473720669,105927603,722446075,463771653,995091580,249784900,362569914,441674995,310891328,443049614,246899301,965628034,8254466,860524980,284046782,649020090,775603661,428599344,313235165,263427830,820210693,584450609,715520777,908274787,449173641,87370462,342675806,667579940,561795065,279679436,78896243,594101806,340351880,104853227,138938342,130890251,986495418,544733609,4904868,918156620,404489692,770967340,158370004,816861962,480737664,420524209,65348113,118371296,286699742,510283129,473058849,602863780,673888495,988224796,727422266,795625516,490010237,643547208,665131,419311146,784876961,259406228,321460624,655258314,98643949,707960681,345366515,677618898,819757880,180025997,737935835,405543032,644653663,490584749,695118839,274538092,632437141,218813310,317001033,910311278,570111271,796146820,110949981,478241232,875076691,307006856,17300606,881553988,227466914,19672824,445302346,910482839,824976273,771616985,270947557,648646822,178180365,137542155,231821182,856901587,993964922,484362438,16217817,162346196,574504715,996863845,926110356,738560761,655452606,847777767,703924556,354719140,551933392,763321879,354410308,716633014,1846113,151195567,397207557,287250393,553695703,673890558,607917045,342267556,791423907,84651643,967621908,301902554,650678899,139731715,307636910,810633682,948014515,866935088,81781900,322819981,80052847,573932828,697481470,945729718,9410113,610388108,997427770,256656171,627562817,382326894,562494885,243742734,278115231,479250272,387514542,698268536,155278258,494100421,212623047,421826322,603738319,758527273,20108421,863619073,821332424,145077127,73700185,204576546,189728558,485502293,841644761,408411010,117079890,38907107,309944332,537278263,217025729,109877174,557761881,994419866,217090673,184824249,189099472,261873512,667808941,586325534,253818913,644423004,981219272,454235616,701754988,399397899,785692610,558429063,364031813,729194366,92482293,326481560,788127248,570445426,823876596,20603955,865141725,343095285,26031301,599138469,726882647,873729904,381275973,727797007,386941508,306915726,183392789,965201592,616292959,988382003,843538214,917204899,346845309,346668863,73340530,211574133,101653426,552055822,392352826,621654267,953923388,649516831,344367172,875418231,749373796,143428656,348401571,841064085,727093888,308500124,232930518,733485509,223530088,955719239,372632899,280379514,793982951,815003859,716823510,420238951,258598151,119317972,532691113,996762842,245917194,50278402,340573112,365772418,972353660,426309883,723221198,174677626,399728595,11650076,709841844,146676835,334038704,534725238,837816787,171414317,303642327,974225117,842734160,776201879,74464463,821426588,38248328,706358135,296716438,445075845,550967966,521492915,274952061,556614251,984837941,648055403,343362475,346080515,256832184,740061294,495959165,729601523,779665586,283275797,197810318,781285237,322261298,135677639,604632373,482730911,262343442,41660771,590107402,953568036,946541117,885083598,382285276,488546372,993845228,909184478,271463541,119198618,592620584,461343501,554131598,652118082,21986535,72902987,687268896,974594416,932795074,774765057,809996715,620738499,399787621,225908460,129158745,586852410,796945456,697021411,269610437,381569864,516484640,533382001,851059476,496376048,117921789,762631608,388289544,175140444,127387258,449693463,568876602,791130076,116649615,899544094,666808812,268154883,130425525,40221932,937092326,80681006,358103796,716404824,842684285,441825078,646820416,235503449,135821388,85455680,158341399,477414981,167897791,535112475,396749090,10704220,234934482,908432331,293931387,731582745,517708259,430870409,980420392,541663303,47582098,455847,356474821,316432065,65533322,85175307,860604360,25754605,154738290,446955362,157986406,781848501,717265250,612404709,706983555,387930108,472703372,677443725,177799133,678723533,355862327,142972046,172238730,511971513,645452094,527518247,731876548,273379339,857639774,841031050,684168469,916679331,820059873,456796817,429183481,526395816,775373984,192323739,296194923,11453925,8278520,409297079,104345442,868422849,808037302,743839810,46575892,772073181,957942297,186788115,208353171,135646592,669701582,639767834,840311971,566239834,748856536,516640190,829180498,126741093,161917011,188925427,150241540,772951297,314136411,385047709,234466451,661905614,866978149,839059042,973857347,733512306,484001044,688907798,284583633,843163128,324217435,258023744,669468233,956937740,751439779,199094586,924317766,652240854,19122513,239556480,767073780,140785202,813367160,936382197,597461024,615192889,99527175,845455419,583838047,319841973,802260377,115832001,410302694,791420576,811802215,885506163,821500977,971899082,851076783,60196672,310722366,460528297,552700981,180873604,609943468,121002913,766255808,312289913,495303973,432738621,394225159,138042435,243477827,749475337,982506554,786394249,356445555,307208212,591254491,619425827,823014817,366656624,619489363,370467112,484246020,270725331,784373520,439653758,820309560,908299141,86224435,932013969,318639644,898352741,401192710,659343882,401578858,851699976,894437844,330041436,170941117,14153059,37693984,616445558,690716870,874502721,449868160,438615741,978160598,698174607,168356987,967878048,736417659,453888345,676617343,274124047,420072609,641407652,318526308,878694635,357869926,315485067,491981417,239038656,843844940,132469174,187019771,523408116,78568538,436938993,486874504,190178115,497209923,995074790,367421824,91668637,710596389,130676774,300098050,904649983,186399972,478015100,31995309,124938003,690394397,711461277,224418847,893879446,781314189,667385447,671417846,234638808,828492043,306706238,127550549,408913764,721516183,331471082,457992974,573468634,672708889,320496078,15839498,885759493,255269181,182400335,530581311,167350302,810232079,650720680,59466245,431116020,679317776,758934084,664980914,278125935,348025264,53331501,133097627,149883591,817848624,900353597,783112758,160763163,238831149,797175555,877308397,39070845,482100617,214965479,344558162,818314994,912223989,213213495,601681586,482310162,863251852,596189612,356519615,79512648,728860288,46903013,888534544,385486256,416178481,385498125,754297579,406709645,755011148,514316323,516985593,413423280,621329073,564117448,828524406,252775486,524528481,42844085,139468211,442041842,804331447,187146136,942938062,48018709,834337461,807286248,75266003,280732574,301044356,688918711,25647683,103691471,356516363,217243322,79719269,838371827,316346259,155522062,268147727,896784626,14951415,470321003,897351995,507321798,999092468,68874685,583865802,235668390,90312874,578971101,263295338,318644981,771253152,969556024,131824084,555364659,177742474,729669260,559938709,645894938,160270347,632777852,735217324,61589642,541933100,694117288,376580544,813068041,477645764,759241785,294519817,138399026,394314552,792949591,934868205,819041193,332485645,845462554,259920986,527437780,309337264,591739449,693276974,678480119,428469431,414263601,633022951,981058512,609542121,442518390,77026581,574261907,45939761,737920568,753807865,274216733,964023100,41919658,848001963,814643993,714996880,211223083,698272928,549380518,965060493,372399874,212188347,648269327,436467039,198057536,488255637,528167194,654566249,498591282,602924257,595802738,646051689,150253145,126142258,853051176,170875874,811033647,829409492,857425357,375070363,518017636,69063083,204378752,975976294,661981759,341281076,220949802,4885828,339589091,544292770,477684459,296578003,526152680,426153882,584733693,354769607,628463735,504184872,962340487,38142158,774710008,313026009,667019208,851177716,608703175,623910550,588942604,664771131,452968880,526552415,371180743,282258493,74410802,118586228,758426336,82207020,769851163,277781927,899447517,277445656,39616839,412570835,644230877,858440059,560027549,653979014,875001552,203289190,287668021,641754696,709569308,43100935,284772512,170487827,712473620,931669785,707240839,349659653,794277139,426319109,269062258,846068884,457829908,36333448,71982296,170135174,709589417,640362445,342495088,841147847,514468327,51968927,688332881,584611895,132113828,917337794,108548150,475063670,795449122,558555126,837635461,837398790,732786257,319001333,198776634,810946626,137870240,158957545,908311315,872619945,664937210,129530468,50348417,849250992,450427339,922572008,618206958,175240077,633367395,825631213,39936802,27403736,980209443,779262371,436554500,682438185,561052839,360181026,353621333,474310496,20746302,68473458,219643096,411557429,197822889,985042166,895962278,443227197,694657534,372677833,911855086,115957705,2894605,536809703,508726322,815233294,202866238,433476225,96761804,754748691,466792919,479956599,151220442,177829816,399844787,888113123,399097330,495693949,81831527,833537368,483958348,47205438,634207676,46648320,324465305,531118527,371868789,981861845,921860206,357792113,268133259,449878693,361697226,350302884,384502541,807638467,401727573,296595730,412192383,145193636,106948516,3274189,223117995,960114799,268522421,204477956,437168126,325814640,387503614,433365363,347193177,114791516,287624303,430900437,940374225,632412154,23409301,547541020,512608806,578807697,443850675,5115349,998330168,653893017,303025260,336219981,882601668,795371447,48538713,649982328,900426809,204558688,653011158,902349808,721480596,211527284,537042464,205459599,475474028,64102375,853122196,239920785,753481311,642672336,182498000,718392117,549190582,899919385,767441910,35831479,901647580,137195945,850922759,981466142,141143905,255873943,17469473,106878802,323468994,459042064,94155677,187551272,530795115,841137570,840248223,467431845,558036327,921180701,678207516,1019817,872202044,963467544,475231870,830760447,628149884,815665664,375159522,861034044,673757389,843558921,902155560,139925365,289287052,504975434,849956279,648860855,869159839,414498699,622880301,864481378,660870295,35825964,519112735,289509856,740089688,822326716,753855755,602596414,1109355,754139240,250452233,191723709,326890640,507591365,152617786,622540065,459313960,564872639,166169821,541421526,188455009,285814597,799131049,175583016,672155446,828067027,801824583,213660817,886755915,514271522,943728970,835578492,73898409,190233572,705737629,435786777,417962929,641806606,869002706,829030184,397303232,674375995,679117195,973411258,659801480,501680008,664225170,908592101,865742350,638569176,168434599,853467653,359584409,640470390,23426105,659816341,644551169,764375544,945112227,88908366,886796928,694202384,816609751,82067555,890808672,203263109,300688088,732861256,981916446,564396474,204963325,607728934,614958095,285589169,516095757,551094266,796996621,156954972,634388393,852919824,951660340,189903249,742460748,240586351,528192736,774856085,78349297,847820063,639182499,674861708,639386368,366465454,369085072,941855646,531030372,760045418,480033669,224399621,110676735,77894517,545100769,650036395,782411682,962394741,21843833,38211912,301959296,579172254,717618843,843531032,975044897,58041033,766509189,888183450,244812160,640598259,649762851,615130101,927355391,740355273,905877239,553665946,824681504,870741191,139576181,919136090,495445285,91191794,139114484,731888951,541278579,314602668,16987211,198661311,712653322,926287373,482220726,956316286,228847458,381771477,724133392,791833167,706068732,996128105,320758457,663466380,327857483,676436428,690021915,504579084,26454933,16038420,157332008,306612706,904818841,445167189,9788408,839132483,90815021,21240951,414051598,130410650,135585214,770455357,647097700,561791251,86951298,11152992,922303224,208184587,6841115,718101467,857264452,585184040,542078386,140828336,809217592,638678485,815085314,193686441,855968166,970509445,602237603,611862881,391504097,76180522,333766430,525156436,459238750,305034567,895552840,295066216,956616889,571451636,714628325,585109252,509577117,351713057,195899084,349961266,813092778,148381618,745829599,725655669,748588140,621061444,87647661,665131400,804407057,786532432,691904089,451188034,420540937,823629411,501560473,400304903,170995170,561965062,721365870,266485419,91353374,947548163,909485397,610766863,928768342,752476980,441431572,344041962,943797032,853458881,702717288,445291878,61235934,456839561,410924722,404926961,194445311,3253589,268799687,807715039,165570205,94763007,158306605,59996720,274108420,414975259,983466636,803394057,87834837,574595575,196191313,844184041,643147106,265818227,101825403,803094044,242562562,839565513,257892092,574135690,30145655,49394657,421361571,763184678,603286204,63452252,139115489,625872226,142064665,516455732,973365994,958346799,583866149,186848069,489388729,440618058,187594059,846920656,584588550,616313658,3266654,507592373,865597837,267145356,510206456,802988440,301697767,64190024,581850323,674500561,355471294,195184459,623420775,920680841,395802067,36642064,470851029,943460901,146732447,166316690,872709391,126163258,950023387,101278761,491582731,639895584,61360863,586337165,193437174,552504580,693546897,77325413,857246661,987532374,853902175,379482747,224733307,115257579,106764520,689354918,298145603,615933962,569076226,328110256,576610866,695851486,785702358,63361341,668886213,927416154,205447692,221665715,199018602,312778040,955638524,26314956,606209807,798483805,709244795,920512580,468134742,745396228,986457805,135914446,938859944,981668478,72804351,522197666,860257082,596201427,493861891,710705969,618177588,806422332,384646184,15076428,70418215,667793574,975770871,145622217,570087218,978775711,739657384,699703979,618576462,77620368,285330510,467646369,523665167,206787932,197281506,634072288,709815314,362695335,705107095,800750169,71227268,423934847,308691367,770269500,363173300,650047647,81854737,334356152,453881875,466676494,994235921,832409515,685904093,721393779,959528791,342024694,744393265,906332280,882992383,951553609,623237368,593348519,199174689,588962133,712620977,829971737,92699062,201761485,45911817,990840621,857165467,840414737,1682954,352749330,3508071,838779094,458972227,647824348,828853075,950000780,854164863,399806922,879137749,212809520,441388638,144475028,395432544,105501058,160504943,669871158,923468766,596352947,692135476,175271758,923738960,503723361,190427004,640326947,678777547,184825262,67184272,194306888,133850550,450428122,75615536,741791390,977784377,981027538,544519858,427234643,976704600,361798085,133012903,839594448,100126660,908636534,415538309,584596772,305392053,367924415,948183134,494350435,706048566,799246183,572044829,73980418,267969547,258397918,211323896,386265065,262530252,151632629,699477545,377982638,771089164,294157205,127574041,87518070,573824443,191094180,590706530,933044004,329309631,892336948,753191963,577284521,987655631,706226766,357305902,594001349,519944161,260808786,181254075,320550296,676860353,328279132,870078596,887434314,258428228,735863058,526730496,236824101,617672087,484961716,63592603,319080338,172014318,475800730,595644977,916663289,738833794,95142235,582969930,486005752,579654560,233475558,54979317,440981254,204736513,489746958,897493865,290680817,879214818,771503873,523135574,792496199,954421607,312608844,349332001,664809479,198788345,372404311,605294124,407806619,306664482,343210044,136280115,678649477,913353839,660918937,761402028,275123138,420140584,395211897,219680467,579084043,391235114,8289646,28760027,347597509,581880420,699243937,56807945,594102464,740568527,685070977,521639273,646019716,37875196,90174632,528595207,207905340,714735302,742634562,635357725,612536743,904636671,358757469,321315689,937533791,479528324,494454809,720036892,917778389,589828633,767794056,640058434,257510447,840866704,311455590,450659980,49891365,599529716,781179867,510612374,709837151,16962196,107146451,0);
	inv,now,n,m,ans,mo,p,facnm:int64;
	fac:array[0..30]of int64;
	i,j:Longint;
function power(a,b:int64):int64;
var ret:int64;
begin
	if b=0 then power:=1
	else begin
		ret:=power(a*a mod 1000000007,b div 2);
		if b mod 2=1 then ret:=ret*a mod 1000000007;
		power:=ret;
	end;
end;
begin
	read(n,m);
	ans:=1;
	mo:=1000000007;
	fac[0]:=1;
	for i:=1 to 30 do fac[i]:=fac[i-1]*i mod mo;
	facnm:=facs[(n-1)div 100];
	for i:=1 to (n-1) mod 100 do begin
		facnm:=facnm*(n-i)mod mo;
	end;
	inv:=power(facnm,mo-2);
	i:=2;
	while i*i<=m do begin
		if m mod i=0 then begin
			p:=0;
			while m mod i=0 do begin
				m:=m div i;
				inc(p);
			end;
			now:=facnm;
			for j:=1 to p do now:=now*(n+j-1)mod mo;
			ans:=ans*now mod mo*power(fac[p],mo-2)mod mo*inv mod mo;
		end;
		inc(i);
	end;
	if m>1 then ans:=ans*facnm mod mo*n mod mo*inv mod mo;
	writeln(ans);
end.