The program and data together fit in the lowest page (0-4095) The stack fits in the highest page.
means they will only occupy one frame since frame size is 4KB.so one entry is for this page in first level
and stack occupy highest page so one more entry for stack,as only required pages are brought in memory.
so total 2 entries in first level page table
So, while the total number of page table entries is 1048576, of those you only use 2 entries, one for each of those 2 pages (entry 0 points at the code/data page and entry 1048575 points at the stack page)
but for two level paging there will be 2 more entries for two first level pages i mentioned above
for more detailed https://stackoverflow.com/questions/12485737/oper-systems-and-memory-management-theoretical