program Project2; {$APPTYPE CONSOLE} uses SysUtils; var a:array[1..100000] of integer;m,n:int64;k,i:integer;input,output:text; begin assign(input,'problem.in'); assign(output,'problem.out'); reset(input); rewrite(output); read(input,n,m); close(input); k:=0; a[1]:=1; a[2]:=2; for i:=3 to n do begin a[i]:=a[i-1]+a[i-2]; if a[i] mod m=0 then k:=K+1; end; write(output,k); close(output); end.