import java.util.*; import java.io.*; // This file is a "Hello, world!" in Java language by OpenJDK for wandbox. class Main { public static void main(String[] args) { new Main().run(); } final long m=(long)1e9+7; void run(){ Scanner sc=new Scanner(System.in); int N=sc.nextInt(); long p=sc.nextLong(); long[] a=new long[N+1]; long[] s=new long[N+1]; a[1]=0; a[2]=1; for(int i=3;i